Dr. Steve wrote:
> Jack: I'm far from an expert in this, but would this help you out?
>
> http://www.pbs-one.com/pbstemp/orderform.html
>
Thanks Dr. Steve, that is just the kind of thing I am trying to do. I looked
at the code and still couldn't figure out why theirs will treat the numbers
as numbers and mine won't, so I'm still up in the air...
Jack
> >This is probably a very stupid javascript question, but I am
> baffled by it.
> >
> >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.
> >
> >Seems simple enough. Problem is that my javascript is treating
> the numbers
> >in the text boxes as strings, so instead of getting 1 + 2 + 3 =
> 6 I get 1 +
> >2 + 3 = 123.
> >
> >I'm doing this in the script:
> >
> >function calctotal(){
> > myform.total.value = myform.text1.value + myform.text2.value
> >}
> >
> >This is being called on the onClick. The myform.total.value should be the
> >sum of the numbers, but they are being treated as strings. The onClick is
> >working, because I'm seeing the results in the text box where I expect
> them.
> >I've been digging through various javascript sources looking for
> an answer,
> >but can't find one. I've seen eval(a + b) used to combine strings, but is
> >there some opposite function to force math?
> >
> >Thanks,
> >Jack
> >
> >____________________________________________________________________
> >--------------------------------------------------------------------
> > 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.
> >---------------------------------------------------------------------
> >
>
> ____________________________________________________________________
> --------------------------------------------------------------------
> 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.
> ---------------------------------------------------------------------
>
____________________________________________________________________
--------------------------------------------------------------------
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.
---------------------------------------------------------------------