Format Integers – Insert Commas

[Total: 0    Average: 0/5]

This will format form fields by inserted commas in them.

Head Code:

function convert(x)
  var _x=x.toString();
  var _len=_x.length;
  var _ret="";
  for(var i=_len;i>0;i--)
  return _ret;
function doit()
 var _f=document.f1;
 var _n1=parseInt(_f.n1.value);
 var _n2=parseInt(_f.n2.value);
 var _answer=_n1*_n2;


Body Code:

Click the equal button to see the numbers transformed.
<form name=f1>
<input name=n1 value=1290>
<input name=n2 value=1780>
<input type=button value="=" onclick="doit()">
<input name=a value="?">
<input name=b1 value="0">
<input name=b2 value="90">
<input name=b3 value="890">
<input name=b4 value="7890">

<input name=b5 value="67890">
<input name=b6 value="567890">
<input name=b7 value="4567890">
<input name=b8 value="34567890">
<input name=b9 value="234567890">
<input name=b10 value="1234567890">

Times Viewed: 0

Leave a Reply

Your email address will not be published. Required fields are marked *