By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,850 Members | 1,962 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,850 IT Pros & Developers. It's quick & easy.

JavaScript problem with "{ }" and ";" symbols

P: 58
can somebody explain me where to put "{ }" and ";" symbols on a script?
i did search the web but didn't find any explanation written in a way i can understand.
example of a code that i tried and doesn't work

Expand|Select|Wrap|Line Numbers
  1. <script Language="JavaScript">
  2. function distance()
  3. }
  4. alert("Point One");
  5. var x = prompt("Enter a X variable for the first point", "X");
  6. var y = prompt("Enter a Y variable for the first point", "Y");
  7. alert("Point Two");
  8. var x$ = prompt("Enter a X variable for the second point", "X");
  9. var y$ = prompt("Enter a Y variable for the second point", "Y");
  10. var x# = x$-x
  11. var y# = y$-y
  12. var x@ = Math.pow(x#,2)
  13. var y@ = Math.pow(y#,2)
  14. var D = y@+x@
  15. var Ds = Math.sqrt(D);
  16. document.write("The distance between the points")
  17. document.write("("+x+","+"y"+")")
  18. document.write("("+x$+","+y$+")")
  19. document.write("Is "+Ds)
  20. {
  21. </script>
  22. <FORM>
  23. <INPUT TYPE="button" onClick="distance()" value="Go!">
Notes:
# the click button works
# it is inside the body of an HTML code...
# im a "newb"
# Links are welcome
Sep 23 '08 #1
Share this Question
Share on Google+
2 Replies


P: 58
NVM, i found out that i can't user a non-literal variable... my mistake
Sep 23 '08 #2

P: 93
Are you satisfied with what you got or you still need the explanation.If so let us know.
Sep 23 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.