Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
<html>
<head>
<script language="javascript">
function Calculate(){
var Total = 0;
var maxRadio = 3;
for (var i=1;i<=maxRadio;i++){
if (eval("document.forms.frmDemo.chk" + i + ".checked")==true){
Total += parseFloat(eval("document.forms.frmDemo.chk" + i + ".value"))
}
}
alert("Your total is: $" + Total)
}
</script>
</head>
<body>
<form id=frmDemo>
<input type=checkbox value="30.00" id=chk1>Shirt: $30.00<br>
<input type=checkbox value="47.50" id=chk2>Pants: $47.50<br>
<input type=checkbox value="65.37" id=chk3>Silk Tie: $65.37<br><br>
<input type=button value="Calculate" onClick="Calculate()">
</form>
</body>
</html>
<html>
<head>
<script language="javascript">
function Calculate(){
var Total = 0;
var maxRadio = 3;
for (var i=1;i<=maxRadio;i++){
if (eval("document.forms.frmDemo.chk" + i + ".checked")==true){
Total += parseFloat(eval("document.forms.frmDemo.chk" + i + ".value"))
}
}
alert("Your total is: $" + Total)
}
</script>
<script language="vbscript">
Sub vbCalculate()
Dim Total, maxRadio, i
Total = 0
maxRadio = 3
For i = 1 to maxRadio
If Eval("document.forms.frmDemo.chk" & i & ".checked = True") Then
Total = Total + eval("document.forms.frmDemo.chk" & i & ".value")
End If
Next
Total = FormatCurrency(Total)
MsgBox("Your total is: " & Total)
End Sub
</script>
</head>
<body>
<form id=frmDemo>
<input type=checkbox value="30.00" id=chk1>Shirt: $30.00<br>
<input type=checkbox value="47.50" id=chk2>Pants: $47.50<br>
<input type=checkbox value="65.37" id=chk3>Silk Tie: $65.37<br><br>
<input type=button value="Calculate" onClick="vbCalculate()">
</form>
</body>
</html>