goggi
05-23-2006, 01:50 PM
value of my variable is 1, i want to format its output as 001
how to do this?
thanks
how to do this?
thanks
|
||||
value of my variable is 1, i want 001goggi 05-23-2006, 01:50 PM value of my variable is 1, i want to format its output as 001 how to do this? thanks elchoco 05-23-2006, 02:13 PM Something like this could work: <script language="JavaScript"> <!-- function pad(number,length) { var str = '' + number; while (str.length < length) str = '0' + str; return str; } alert(pad(2,5)); //--> </script> http://www.irt.org/script/183.htm Good luck goggi 05-23-2006, 02:24 PM thanks but it sais "00002" goggi 05-23-2006, 02:26 PM ok, i got it ;) thank a lot! goggi 05-26-2006, 12:40 PM and what about analogue with VBscript? goggi 05-26-2006, 01:54 PM found it n=1 'an integer s=right("000" & n,3) 'a string msgbox s |
| |||
EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum