Hi there, Im a little stuck here, my problem is im making a house insurance form where you enter data into the feilds and the calculations link back to create the end result amount i cant seem to get the right values in the form i have all the variables correct but just linking the two is where i need a little help where have i gone wrong? and what do i need to change in order to make it work.
Here is my code so far:
I hope you guys are so kind enough to help me out with this one
Cheers
Here is my code so far:
Code:
<script language="javascript" type="text/javascript">
function houseInsurance( ){
var basePay = (a*0.0015)+(b*0.012)
var x = (basePay*1.15)
var y = (basePay*1.05)
var totalPremiums = (x+y)*1.10
var result = c*totalPremiums
return result;
}
function calculate( ) {
var a = parseInt (document.form.housevalue.value)
var b = parseInt (document.form.contentsvalue.value)
var c = parseInt (document.form.noclaimbonus.value)
document.form.total.value = result
}
</script>
<body>
<form name = "houseInsurance"><h1>House Inurance:</h1>
House Value<br>
<input type = "Text" value = "Enter Amount" name = "1">
<br>
Contents Value<br>
<input type = "Text" value = "Enter Amount" name = "2">
<br>
No Claim Bonus<br>
<input type = "Text" value = "Enter Amount" name = "3">
<br>
<input type = "button" value = "result" Name = "click"
onClick = "calculate()">
<br>
Total<br>
<input type = "Text" value = "Total" name = "4">
</body>
Cheers
Comment