[thelist] JavaScript Question

Jay Blanchard jblanchard at pocket.com
Tue May 2 12:36:37 CDT 2006


I have a calc that I am doing by echoing JavaScript with PHP. It work
just dandy, but I need to format the result with two decimal places. I
have searched the web (and I have seen toFixed, etc.) but the functions
will not work with the calc;

echo "<input type=\"text\" name=\"phoneQuant$phoneLine\" size=\"3\"
maxlength=\"2\" style=\"color: #000000; background-color: #FFFFCC;
text-align: right;\"
onkeyup=\"document.dealerOrder.phoneTotal$phoneLine.value =
(document.dealerOrder.phoneQuant$phoneLine.value *
document.dealerOrder.dealerCost$phoneLine.value)\">";

It is just a formatting issue for display. I have tried adding + ".00"
etc...but no joy. It would be nice to be able to do something like

document.dealerOrder.phoneTotal$phoneLine.value.".00" but we all know
that that does not work. Can someone point me in the right direction
without having to cobble together a bunch of code?



More information about the thelist mailing list