I have a page that adds up amounts assigned to checkboxes in a form and gives a total at the bottom of the page, this is done with some javascript i found as i am useless with it.
What i am tring to do is change the part of the page that is visible if the amount of the total gets above a certain amount.
this is the code that shows the totals
and this is the javascript that keeps the totals with an onclick in the checkbox
I am able to make something like this work with asp but dont really want to have to reload the page on every click
can anyone help
the page can be found at http://www.yaketyyakallmouth.com/rad...new/local2.asp
What i am tring to do is change the part of the page that is visible if the amount of the total gets above a certain amount.
this is the code that shows the totals
Code:
<TABLE width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
<TR>
<TD width="50%"><DIV align="right">Total £
<INPUT name="answer" type="text" id="answer" style="border: none" value="" size="5" readonly="readonly"/>
</DIV></TD>
<TD width="50%"><DIV align="right">Total £
<INPUT name="answer2" type="text" id="answer2" style="border: none" value="" size="5" readonly="readonly"/>
</DIV></TD>
</TR>
</TABLE>
Code:
<script type="text/javascript">
function calculate(f)
{
var nums = f.num;
var ntext = f.num;
var result = 0;
for(var i=0;i<nums.length;i++)
{
if(nums[i].checked)
{
result+=parseFloat(ntext[i].value);
}
}
f.answer.value=Number(result).toFixed(2);
}
</script>
<script type="text/javascript">
function calculate2(f)
{
var nums2 = f.num2;
var ntext2 = f.num2;
var result2 = 0;
for(var i=0;i<nums2.length;i++)
{
if(nums2[i].checked)
{
result2+=parseFloat(ntext2[i].value);
}
}
f.answer2.value=Number(result2).toFixed(2);
}
</script>
can anyone help
the page can be found at http://www.yaketyyakallmouth.com/rad...new/local2.asp
Comment