Best Download Sites Login
Site Login

Adding Commas To Numbers

Description
Use Javascript to modify numbers by adding commas after every third digit. For example, 123456789 is converted to 123,456,789. The script example shows this script as used on numbers of various sizes....View A Script Demo


Do you find it confusing setting up these script?
Java Scripts Magic can do all the hard work for you all At The Touch Of A Button.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<LINK href="general.css" rel="stylesheet" type="text/css">
<SCRIPT LANGUAGE="JavaScript">
<!-- Original:  Martin Webb -->
<!-- Web Site:  http://www.irt.org -->
<!-- Begin
function Comma(number) {
number = '' + number;
if (number.length > 3) {
var mod = number.length % 3;
var output = (mod > 0 ? (number.substring(0,mod)) : '');
for (i=0 ; i < Math.floor(number.length / 3); i++) {
if ((mod == 0) && (i == 0))
output += number.substring(mod+ 3 * i, mod + 3 * i + 3);
else
output+= ',' + number.substring(mod + 3 * i, mod + 3 * i + 3);
}
return (output);
}
else return number;
}
//  End -->
</script>

</HEAD>

<BODY Background=../graphics/grayback.jpg >
<center><BR><BR><BR>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
document.write(Comma(1)+'<BR>');
document.write(Comma(12)+'<BR>');
document.write(Comma(123)+'<BR>');
document.write(Comma(1234)+'<BR>');
document.write(Comma(12345)+'<BR>');
document.write(Comma(123456)+'<BR>');
document.write(Comma(1234567)+'<BR>');
document.write(Comma(12345678)+'<BR>');
document.write(Comma(123456789)+'<BR>');
document.write(Comma(1234567890)+'<BR>');
//  End -->
</script>

</center>
</BODY>
</HTML>
 

Business Proposal If you have a Business Proposal that you think may be of interest to us here at Best Download Sites please contact us to discuss the matter in further detail