simon
|
| Posted: 05/24/2011, 9:07 AM |
|
I'm trying update a bit of PHP code someone else did....
I need to fix an issue ie. decimal formatting
A HTML is built like this
str += "<tr><td style='color:#0066ff'>" + pprice +
And displayed like this
document.getElementById("prcontent").innerHTML = str;
I need to make 'pprice' display with 2 decimal place ie. 56.80 (currently
displaying as 56.8)
I tried replacing + pprice + with this + "number_format(" + pprice + ", 2,
'.', '')"
but not working - its showing the text number_format(....
|
|
|
 |
datadoit
|
| Posted: 05/24/2011, 10:08 AM |
|
See: http://www.w3schools.com/jsref/jsref_tofixed.asp
This is javascript, and there is no number_format() for javascript.
|
|
|
 |
|