Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Object doesnt support this method or property in IE ?

Status
Not open for further replies.

2levelsabove

IS-IT--Management
Feb 25, 2008
5
0
0
US
function CurrencyFormat(num) {
num = num.toString().replace(/\$|\,/g,'');
if(isNaN(num)) {
num = "0";
}
sign = (num == (num = Math.abs(num)));
num = Math.floor(num*100+0.50000000001);
cents = num % 100;
num = Math.floor(num/100).toString();
if(cents < 10) {
cents = "0" + cents;
/*for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++) {
num = num.substring(0,num.length-(4*i+3))+','+num.substring(num.length-(4*i+3));
}*/
}
return (((sign)?'':'-') + '$' + num + '.' + cents);
}
 
I figured it out myself.


Had to declare the cents variable.


<clap clap>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top