i am having a problem getting my js file to work with my html file
here is my jsfile
function calculateTotal () {
var hours = document.getElementByName("hours")[0].value;
alert(please enter a number)
var payrate = document.getElementByName("payrate")[0].value;
alert(please enter a number)
var pay = document.getElementByName("pay")[0].value;
if (hours <= 40){
pay = (hours * payrate)
}
else if (hours >40) {
pay = (hours * payrate) + (hours - 40) * payrate * 1.5;
}
}
and here is my html file
<table>
<tr>
<td width="135">Weekly hours worked</td>
<td width="144"><input type="text" name="hours" /></td>
</tr>
<tr>
<td>Pay per hour</td>
<td><input type="text" name="payrate" /></td>
</tr>
<tr>
<td>Weekly pay</td>
<td><input type="text" value="document.getElementsByName(“pay”)[0].value = pay" name="pay" onclick="calculateTotal" /></td>
</tr>
<tr>
<td colspan="2" style="text-align: center">
<button>Calculate</button>
</td>
</tr>
</table>
i am trying to get the javascript function to go into the html text feild for <td>weekly pay</td> any thoughts of what i am doing wrong