ITGuru2003
MIS
I am trying to calculate the total cost of four items using checkboxes but getting back type mismatch for my "Calculate" function (see code extract below) - can you please tell me where I am going wrong? Any help would be greatly appreciated.
<head>
<SCRIPT LANGUAGE="VBScript" type="text/vbscript">
<!--
Option Explicit
Dim curTotal
Sub Calculate
Dim MyForm
Set MyForm=Document.frmRegister
If MyForm.chkBOOK1.Checked Then
curTotal=curTotal+10
End If
MyForm.lblTotal.Caption="£" & curTotal & ".00"
MyForm.txtTotal.Value=curTotal
End Sub
-->
</SCRIPT>
</head>
<body>
<TD COLSPAN=6>
<FORM NAME="frmRegister" METHOD="POST" ACTION="" >
<TABLE WIDTH=400 BORDER=0>
<B><FONT SIZE=2>
<TR>
<TD COLSPAN=1>
</TD>
<TD NOWRAP COLSPAN=1>
<INPUT TYPE="CHECKBOX" NAME="chkBOOK1"
VALUE="Yes" OnClick="Calculate">
BOOK1 £10 </br>
</TD>
<TD NOWRAP COLSPAN=1>
<INPUT TYPE="CHECKBOX"
<OBJECT
ID="lblTotal"
HEIGHT=20
WIDTH=100
>
<PARAM NAME="ForeColor" VALUE="#000000">
<PARAM NAME="Caption" VALUE="£50.00">
<PARAM NAME="BackStyle" VALUE="0">
<PARAM NAME="FontName" VALUE="Arial">
<PARAM NAME="FontSize" VALUE="20">
<PARAM NAME="FontBold" VALUE="True">
<PARAM NAME="Visible" VALUE="True">
</OBJECT>
<INPUT TYPE="Text" NAME="txtTotal" VALUE="50">
</TD>
</TR>
<TR>
<TD COLSPAN=3 ALIGN="CENTER">
<INPUT TYPE="SUBMIT">
<INPUT TYPE="RESET">
</TABLE>
</FORM>
</BODY>
</HTML>
<head>
<SCRIPT LANGUAGE="VBScript" type="text/vbscript">
<!--
Option Explicit
Dim curTotal
Sub Calculate
Dim MyForm
Set MyForm=Document.frmRegister
If MyForm.chkBOOK1.Checked Then
curTotal=curTotal+10
End If
MyForm.lblTotal.Caption="£" & curTotal & ".00"
MyForm.txtTotal.Value=curTotal
End Sub
-->
</SCRIPT>
</head>
<body>
<TD COLSPAN=6>
<FORM NAME="frmRegister" METHOD="POST" ACTION="" >
<TABLE WIDTH=400 BORDER=0>
<B><FONT SIZE=2>
<TR>
<TD COLSPAN=1>
</TD>
<TD NOWRAP COLSPAN=1>
<INPUT TYPE="CHECKBOX" NAME="chkBOOK1"
VALUE="Yes" OnClick="Calculate">
BOOK1 £10 </br>
</TD>
<TD NOWRAP COLSPAN=1>
<INPUT TYPE="CHECKBOX"
<OBJECT
ID="lblTotal"
HEIGHT=20
WIDTH=100
>
<PARAM NAME="ForeColor" VALUE="#000000">
<PARAM NAME="Caption" VALUE="£50.00">
<PARAM NAME="BackStyle" VALUE="0">
<PARAM NAME="FontName" VALUE="Arial">
<PARAM NAME="FontSize" VALUE="20">
<PARAM NAME="FontBold" VALUE="True">
<PARAM NAME="Visible" VALUE="True">
</OBJECT>
<INPUT TYPE="Text" NAME="txtTotal" VALUE="50">
</TD>
</TR>
<TR>
<TD COLSPAN=3 ALIGN="CENTER">
<INPUT TYPE="SUBMIT">
<INPUT TYPE="RESET">
</TABLE>
</FORM>
</BODY>
</HTML>