<ptml> <pead> <title> Digital amounts are thousands separated </title> <script language= "JavaScript" >//Thousands separation of digital amounts function Formatnum (theobj) {var digit = TheObj.value.indexOf (".");//Get decimal position var int = theObj.value.substr (0,digit); Gets the integer part of the decimal number var i; var mag = new Array (); var word; if (TheObj.value.indexOf (".") = = 1) {//Integer i = theObj.value.length;//number of integers while (i > 0) {word = Theobj.value.s Ubstring (i,i-3); Interception of a group of digital i-= 3 per 3 bits; Mag.unshift (word); The intercepted numbers are pressed into the array respectively} Theobj.value = Mag; Mag.unshift (word); } theobj.value = mag + theObj.value.substring (digit); } </script> </title> </pead> <body> <label> Thousands of digits: <input type= "Text" Name= "num" value= "88888888.88"/> </label> <label> <input type= "button" name= "button" value= "Convert" onc lick= "Formatnum (document.all.num);d oCument.all.button.disabled= ' true '; "/> </label> </body> </ptml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]