JRS: In article <vs*******************@twister.nyroc.rr.com>, dated
Tue, 11 Oct 2005 15:00:43, seen in news:comp.lang.javascript, Mick White
<mw***********@rochester.rr.com> posted :
myvalue=parseFloat(document.forms["myform"].elements[counter].value,10);
,10 // ???
IMHO, parseFloat should only be used if the number part of the string
may have training characters; and parseInt only then or if the second
parameter may not be 10. Unless I've forgotten something.
Generally, when reading a number, one should IMHO do something like
myvalue = +document.forms["myform"].elements[counter].value
as it gets the conversion from "outer" to "inner" format out of the way,
and enables the inner value to be checked with a quick alert(myvalue) .
--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.