That's a little kludgy, though, right? There is a valueOf() operator. That should get the numeric value out of a string. That might be more clean and appropriate.
-Rob > On 20020703.1251, Benjamin Huot said ... > > I did what you said and several variants of it and it seems to work. > > Thanks, > > Ben > > 7/3/2002 11:55:20 AM, Rob Hudson <[EMAIL PROTECTED]> wrote: > > >If you want to change a string to a number, first make sure there are > >only the characters 0-9 in the string. What I always do is simply > >multiplying the string by 1. > > > >var c = '1234'; > >d = c * 1; > > > >Since multiplying assumes numbers, JavaScript makes the string a > >number, if possible. If that isn't possible, the result is NaN. > > > >-Rob > > > >> On 20020703.1154, Benjamin Huot said ... > >> > >> I'm trying to write some accounting scripts with JavaScript, but it is just >appending one number onto the > other > >> number instead of adding them. Is there some way to specify a number value in the >JavaScript or the form. > >> > >> http://blessedforest.org/account/total.html > >> > >> Oh. and my OpenBSD firewall is up due to the tenacity of Jacob. It works just >fine except that Windows wants > to > >> log on to the Internet when I boot my computer - but I just unlplug it from the >phone jack and turn off the > modem > >> when I'm not using it. > >> > >> Ben > >> Landscapes of the Mind > >> [EMAIL PROTECTED] > >> > > > Landscapes of the Mind > [EMAIL PROTECTED] >
