Welcome to WebmasterWorld Guest from 50.19.53.104

Forum Moderators: open

Message Too Old, No Replies

number to string viceversa

     

Sayantandutta

3:39 pm on Oct 24, 2011 (gmt 0)




var aaa= formName.subtotal.value;
var bbb = formName.Hour.value * formName.Rate.value;
formName.subtotal.value= parseFloat ('aaa') + parseFloat ('bbb');



Trying to print subtotal but getting error message as Nan

penders

4:07 pm on Oct 24, 2011 (gmt 0)

WebmasterWorld Senior Member penders is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



... = parseFloat('aaa') + parseFloat('bbb');


There should not be quotes around your variable names.

Sayantandutta

4:39 am on Oct 25, 2011 (gmt 0)



thanks

Skier88

5:28 pm on Oct 27, 2011 (gmt 0)

5+ Year Member



A more succinct method is to use implied conversion:

var aaa = formName.subtotal.value;
var bbb = formName.Hour.value * formName.Rate.value;
formName.subtotal.value = +aaa + bbb;
 

Featured Threads

Hot Threads This Week

Hot Threads This Month