brian.ackermann wrote:
Yeah, so I am discovering.
I decided to build the whole input line in javascript:
<SCRIPT TYPE="text/javascript">
document.write("<INPUT TYPE='TEXT' NAME='AMOUNT'");
document.write(" VALUE='" + roundNumber(43.987654, 5) +"'");
document.write(">");
</SCRIPT>
That's a bit silly, you are creating a dependency on JavaScript that
is simply not required. Why not just use HTML?
<input type="text" name="amount" value="43.98765">
Then you have zero dependency on JavaScript. Presumably any rounding
required for the value can be done on the server when the value is
put into the page in the first place.
If you can't control what the server puts into the page, then run the
rounding function on page load. That way, everyone can seen the
value but those with JavaScript enabled will see the rounded value.
If you want a user-entered value to be rounded, then use an onchange
event.
--
Rob