[thelist] javascript question on formatting numbers.
rudy
r937 at interlog.com
Thu Dec 20 16:50:10 CST 2001
>but I'd like to know if I can format the integer to be say 5 digits long,
>whatever value it is, ie. "00421" for 421
bonjour alliax
<script language="JavaScript"><!--
function pad(number,length) {
var str = '' + number;
while (str.length < length)
str = '0' + str;
return str;
}
file://--></script>
lifted in its entirety from http://developer.irt.org/script/183.htm
note: if the last line above starts with file://--> (thanks a lot, outlook
express, and please fuck off, microsoft) then just remove the "file:"
the last line should start with a double slash, i.e. the javascript comment
to comment out the html closing comment, if you know what i mean
rudy
http://rudy.ca/
More information about the thelist
mailing list