jimmycook
10-15-2008, 02:51 PM
I have a problem with some course work, I am struggling to define my rates (lines 3-6) to the Ski region options. And then into the sum where at the moment it has rate[0].
<script language="javascript">
var rate = new Array();
rate[0] = 8;
rate[1] = 4;
rate[2] = 6;
rate[3] = 12;
function calculate()
{
howmuch= eval("document.form1.InsVal.value")
for(loop = 0; loop <3; loop++)
if (document.form1.cover[loop].checked)
level = loop+1
cost = eval(10 + howmuch/100*rate[0]*level)
document.form1.quote.value = cost
}
function confirmPurchase()
{
if(confirm("Are you sure you wish to purchase this?"))
document.form1.submit()
}
</script>
</head>
<body>
<H1 Align=CENTER>James Cook</H1>
<H2 Align=Center>Ski Boots Insurance Specialists</H2>
<Form name = form1 Method = post
Action="mailto:F07387815@tic.ac.uk">
<P><B> Value of ski boots:</B></P>
<p>
<input type = text NAME = InsVal SIZE = 10>
<P>
</p>
<p>
<b>Ski Region</b></p>
<select size="1" name="D1">
<Option = 1> Massif
<Option = 2> Grand Massif
<Option = 3> Mont Blanc
<Option = 4> Courchevel
</Option>
</select>
<br>
</p>
<p><B>Insurance Type:</B></p>
<p>
<input type = Radio NAME = cover>
Third Party <br>
<input type = Radio NAME = cover>
Third Party Fire and Theft <br>
<input type = Radio NAME = cover CHECKED>
Comprehensive </p>
<P><Input type = "button" Name = "calc" Value = "Get quote"
onClick = "calculate()"></P>
<P><B>Your Quotation:</B></P>
<Input type = "text" NAME = "quote" SIZE = 10>
<P><Input Type = "button" Name ="done" Value = "Purchase"
onClick = "confirmPurchase()">
</P></form>
</body>
</html>
If anyone can help it would be very helpful.
Thanks
James
<script language="javascript">
var rate = new Array();
rate[0] = 8;
rate[1] = 4;
rate[2] = 6;
rate[3] = 12;
function calculate()
{
howmuch= eval("document.form1.InsVal.value")
for(loop = 0; loop <3; loop++)
if (document.form1.cover[loop].checked)
level = loop+1
cost = eval(10 + howmuch/100*rate[0]*level)
document.form1.quote.value = cost
}
function confirmPurchase()
{
if(confirm("Are you sure you wish to purchase this?"))
document.form1.submit()
}
</script>
</head>
<body>
<H1 Align=CENTER>James Cook</H1>
<H2 Align=Center>Ski Boots Insurance Specialists</H2>
<Form name = form1 Method = post
Action="mailto:F07387815@tic.ac.uk">
<P><B> Value of ski boots:</B></P>
<p>
<input type = text NAME = InsVal SIZE = 10>
<P>
</p>
<p>
<b>Ski Region</b></p>
<select size="1" name="D1">
<Option = 1> Massif
<Option = 2> Grand Massif
<Option = 3> Mont Blanc
<Option = 4> Courchevel
</Option>
</select>
<br>
</p>
<p><B>Insurance Type:</B></p>
<p>
<input type = Radio NAME = cover>
Third Party <br>
<input type = Radio NAME = cover>
Third Party Fire and Theft <br>
<input type = Radio NAME = cover CHECKED>
Comprehensive </p>
<P><Input type = "button" Name = "calc" Value = "Get quote"
onClick = "calculate()"></P>
<P><B>Your Quotation:</B></P>
<Input type = "text" NAME = "quote" SIZE = 10>
<P><Input Type = "button" Name ="done" Value = "Purchase"
onClick = "confirmPurchase()">
</P></form>
</body>
</html>
If anyone can help it would be very helpful.
Thanks
James