www.webdeveloper.com
Results 1 to 4 of 4

Thread: What's not right

  1. #1
    Join Date
    Oct 2010
    Posts
    2

    What's not right

    Hello ! I can't find a mistake in this simple code!!
    unfortunately id doesn't do what I need
    It supposed to receive 2 numbers and throw an alert with a multiplication of those numbers.
    pls point me to a mistake
    thanks!
    <html>
    <head>
    <title> Test </title>

    </head>
    <body>
    <h1 align= "center"> Calc </h1>
    <br>
    <script language="JavaScript">
    function mult()
    {
    var a= document.Calc.li1.value;
    var b= document.Calc.li2.value;
    var c= (a*b);
    alert("the answer is :"+c);
    }
    </script>
    <input type="text" id="li1" name="L1">
    <br>
    <input type="text" id= "li2"name="L2">
    <br>

    <input type="submit" name="sbm" value="go" onclick= "mult()">
    <br>

    </body>
    </html>

  2. #2
    Join Date
    Oct 2010
    Posts
    28
    Code:
    var a= parseInt(document.getElementById('li1').value);
    var b= parseInt(document.getElementById('li2').value);

  3. #3
    Join Date
    Oct 2010
    Posts
    2

    Thanks

    Thank you very much!
    if it's possible, is there any site to show all the possible commands for javascript and html???

  4. #4
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    At least 98% of internet users' DNA is identical to that of chimpanzees

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles