math questions
Posted: Tue Apr 15, 2003 11:49 am
im new at javascript and i got two questions;
1) can some one give me the syntax to round a number to two numbers before the decimal.
2) can some one tell me why $totalcost becomes all crazy after reaching 2500?
<html>
<script language="javascript" type="text/javascript">
function testmath()
{
$totalcost=$totalcost+455.99;
blah.innerHTML=$totalcost;
}
$totalcost=0;
</script>
<body>
<font id="blah"></font>
<br><a href="#" onClick="testmath();return false">click here</a>
</body>
</html>
1) can some one give me the syntax to round a number to two numbers before the decimal.
2) can some one tell me why $totalcost becomes all crazy after reaching 2500?
<html>
<script language="javascript" type="text/javascript">
function testmath()
{
$totalcost=$totalcost+455.99;
blah.innerHTML=$totalcost;
}
$totalcost=0;
</script>
<body>
<font id="blah"></font>
<br><a href="#" onClick="testmath();return false">click here</a>
</body>
</html>