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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Netwatcher
    New Member
    • Sep 2008
    • 58

    #1

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

    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

    Code:
    <script Language="JavaScript">
    function distance()
    }
    alert("Point One");
    var x = prompt("Enter a X variable for the first point", "X");
    var y = prompt("Enter a Y variable for the first point", "Y");
    alert("Point Two");
    var x$ = prompt("Enter a X variable for the second point", "X");
    var y$ = prompt("Enter a Y variable for the second point", "Y");
    var x# = x$-x
    var y# = y$-y
    var x@ = Math.pow(x#,2)
    var y@ = Math.pow(y#,2)
    var D = y@+x@
    var Ds = Math.sqrt(D);
    document.write("The distance between the points")
    document.write("("+x+","+"y"+")")
    document.write("("+x$+","+y$+")")
    document.write("Is "+Ds)
    {
    </script>
    <FORM>
    <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
  • Netwatcher
    New Member
    • Sep 2008
    • 58

    #2
    NVM, i found out that i can't user a non-literal variable... my mistake

    Comment

    • Rsmastermind
      New Member
      • Sep 2008
      • 93

      #3
      Are you satisfied with what you got or you still need the explanation.If so let us know.

      Comment

      Working...