Prev: FAQ Topic - Why does 1+1 equal 11? or How do I convert a string to a number? (2010-04-02)
Next: FAQ Topic - How do I generate a random integer from 1 to n? (2010-04-03)
From: Sudhanshu on 2 Apr 2010 13:25 I'm not able to use the values of text boxes. can anyone help me to do so. thank u. <body text=white> <form name="frm1"> <h3>Mathematical Operations<h3> <table border=2 bgcolor=black cellpadding=10 name="tbl"> <tr><td> Number 1:<input type="text" name="num1"width=15> <br> Number 2:<input type="text" name="num2" width=15> </td></tr><tr><td> Operator : <input type="button" name=pls value=" + " OnClick="calc("+",frm1)"> <input type="button" name=mns value=" - " OnClick="calc("-",frm1)"> <input type="button" name=mul value=" X " OnClick="calc("*",frm1)"> <input type="button" name=dvv value=" / " OnClick="calc("/",frm1)"> </td></tr><tr><td> Answer :<input type="text" name="ans" width=15> </td> </tr> </table> </form> </body>
From: Sean Kinsey on 2 Apr 2010 16:30
On Apr 2, 7:25 pm, Sudhanshu <sudhansh...(a)gmail.com> wrote: > I'm not able to use the values of text boxes. can anyone help me to do > so. First of all, start with validating the HTML with eg http://validator.w3.org/ > > thank u. > > <body text=white> See http://www.w3.org/TR/html401/struct/global.html#h-7.5.1 The text attribute is deprecated. > <form name="frm1"> > <h3>Mathematical Operations<h3> > <table border=2 bgcolor=black cellpadding=10 name="tbl"> > <tr><td> > Number 1:<input type="text" name="num1"width=15> Missing space > <br> > Number 2:<input type="text" name="num2" width=15> > </td></tr><tr><td> > Operator : > <input type="button" name=pls value=" + " > OnClick="calc("+",frm1)"> The same quote mark used both around and in the attribute value of OnClick, replace with eg. "calc('+',frm1)" |