Hi everyone,
I wonder if you can help me please.
Trying to set the output of a textbox to 2 decimal places and failing completely!
Please find code below:
<script language="javascript">
function multiply()
{
var ans=(document.form.one.value) * (document.form.two.value)
document.form.answer.value=ans;
}
</script>
<title>Home Page</title>
</head>
<body>
<!--The block of code below is HTML - this code sets out the webpage, placing boxes, buttons etc on
the form for the user-->
<center>
<h1 style="color: darkgreen;"><big>Welcome to the main webpage</style></big></h1>
<br/>
<h2>
<p style="background-color: orange;">Input your Rate of Pay and select or input the Hours you Worked this week
into the Input Boxes provided, then click the "Submit Enquiry" button to obtain the calculated result</style></p>
</h2>
<br/><br/>
<form name="form">
Select or Enter the Weekly Hours Worked (Min 1 Max 168) <b><input type="number" name="one" min="1" max="168" required></b>
<br/><br/>
Enter the Rate of Pay (Example 9.30) ÂŁ <input type="text" name="two" required>
<br/><br/>
Weekly wage earned ÂŁ <input type="text" name="answer">
<br/><br/><br/>
<input type="button" value="Submit Enquiry" name="now" onclick="multiply()">
<input type="reset" value="Reset all fields">
<br/><br/>
When I click the button I need the result to be rounded to 2 dec places.
Thanks in advance