> This is probably a very stupid javascript question, but I am baffled by it.
What's the old saw? There are no stupid question!
>
> I'm trying to make a simple "calculator" type form where the values in a
> number of text boxes are added together to get the total. I have named my
> text boxes and put an onClick funtion in an <input type=button> tag. In
> theory, when you click the button, the numbers in the text boxes will be
> added together and the result will show in a "total" text box.
>
Not true. JS converts any form field containing numbers to their
string equivalents. If you want numbers you must use the eval() funtion.
> function calctotal(){
> myform.total.value = myform.text1.value + myform.text2.value
> }
JS assumes the "+" operator is string concatenation. Try:
>myform.total.value = eval(myform.text1.value) + eval(myform.text2.value)
Urb, [EMAIL PROTECTED]
Visit America's Town Square. Creators of extraordinary Web sites.
http://www.usats.com Build your own Home Page without knowing
any HTML. Many user selectable options. After creation, your page
is e-mailed to you. http://usats.com/homepage
____________________________________________________________________
--------------------------------------------------------------------
Join The Web Consultants Association : Register on our web site Now
Web Consultants Web Site : http://just4u.com/webconsultants
If you lose the instructions All subscription/unsubscribing can be done
directly from our website for all our lists.
---------------------------------------------------------------------