Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org

Feedback: irt.org FAQ Knowledge Base Q6

Feedback on: irt.org FAQ Knowledge Base Q6

Sent by Nancy Crisp on July 12, 2000 at 08:25:01: - feedback #1483

Worth:
Very worth reading

Length:
Just right

Comments:
What if the user puts in too many decimal points? the way to get round this is to add

if (test1.length > 2)//check they are not entering loads of decimal points!
{
return false;
}

after you split the string and check the length is == 2.....

this might help!!

Thanks


Sent by Allan Morris on April 02, 2002 at 08:32:52: - feedback #3742

Worth:
Very worth reading

Length:
Just right

Comments:
Thanks for the help, just right


Sent by Pauan on Wednesday May 07, 2008 at 01:20:05 - feedback #5267

Worth:
Worth reading

Length:
Too long

Technical:
Too technical

Comments:
A far easier method is to simply use the toFixed method.

<script type="text/javascript">
var money = 100.50;
document.write(money.toFixed(2));
</script>

The above script will display the variable "money" with a fixed decimal point 2 away, displaying the number 100.50. If you give a toFixed value of 4 instead, the displayed number would be 100.5000.




©2018 Martin Webb