Find jobs - Turquoise Jewelry - Debt Consolidation - Prefessional Book Reviews - Find jobs

PDA

View Full Version : adding vars not text strings


GoldDog
Jun 16th 2005, 2:40 pm
How can I get my function to recognize this...

subt = document.getElementById('subT').innerHTML;

...as a numeric value rather than a text string?

My math...

ty = 23;
subt = document.getElementById('subT').innerHTML;
cost = ty+subt;
document.getElementById('subT').innerHTML = cost;

...does not work. It rewrites 'subT' as a text string, rather than a computed value.

thanks!

gumape
Sep 15th 2009, 4:00 pm
var num = parseFloat (subt);

More info: parseFloat (http://help.dottoro.com/ljrpcvfq.php#parseFloat)