Math.round
Hi, could someone please add the math.code function in the code below so that the resulting answer in the div is to two decimal places.
<script type = <"text/javascript">
function calculate()
{
A = document.getElementById('input').value;
outDiv = document.getElementById('output');
B =(parseInt(A) * 1.0);
//alert(A);
D = (parseInt(B) * 1.0 );
if ( B <= 19)
{
tax = 0.00;
}
else if (B <= 30)
{
tax = (B * 3.95) * 1;
}
else if (B <= 40)
{
tax = (B * 3.75) * 1;
}
else if (B <= 50)
{
tax = (B * 3.70) * 1;
}
else if (B <= 60)
{
tax = (B * 3.55) * 1;
}
else if (B <= 70)
{
tax = (B * 3.40) * 1;
}
else if (B <= 80)
{
tax = (B * 3.25) * 1;
}
else if (B <= 90)
{
tax = (B * 3.10) * 1;
}
else if (B <= 100)
{
tax = (B * 2.95) * 1;
}
else if (B <= 150)
{
tax = (B * 2.80) * 1;
}
else if (B <= 200)
{
tax = (B * 2.65) * 1;
}
else
{
tax = (B * 2.60) * 1;
}
outDiv.innerHTML = '£'+tax;
}
</script>
</head>
<body>
<p style="margin-left: 3">
<b><font face="Arial" color="#008080" style="font-size: 9pt">Enter Quantity
</font><font face="Arial" color="#008080" size="2"> </font></b>
<INPUT TYPE="TEXT" id='input' NAME="text2" size="6" /> </p>
<p> <INPUT TYPE="button" VALUE="SUBMIT" onClick="calculate()" style="color: #800000; font-family: Arial; font-size: 10px"/></p>
<p> </p>
<div id='output'> </div><br>
</body>
</html>