javascripthtmlvisual-c++siemens-nx

How to set two decimal digit in html cell?


The output of the data is something like x.xxxxxxxx in html.

I want to set in two decimal like x.xx.

My code is

"<TD ALIGN=CENTER>$value</TD>"

Solution

  • Typically you should make the change in JavaScript but you can also use JS in HTML using the script tag. So, you can use:

    <TD ALIGN=CENTER><script>document.write(parseFloat($value).toFixed(2));</script></TD>