Hi,
I have a html page (full code is below). It basically asks six questions and scores and keeps a running total in the second to last Textbox. (a sample I found)
I'm trying to figure out how to add pass or fail text in the last textbox (named passfail) if the total score is below 4 or if question 2 or 4 are marked "F".
Any help would be greatly appreciated.
Thanks
Dan
I have a html page (full code is below). It basically asks six questions and scores and keeps a running total in the second to last Textbox. (a sample I found)
I'm trying to figure out how to add pass or fail text in the last textbox (named passfail) if the total score is below 4 or if question 2 or 4 are marked "F".
Any help would be greatly appreciated.
Thanks
Dan
Code:
<html>
<head>
<title></title>
<script language="JavaScript" type="text/javascript">
<!--
function zxcSubTotal(obj,id,tid){
zxct=document.getElementById(tid);
if (!zxct.ary){ zxct.ary=new Array(); }
zxccbs=obj.getElementsByTagName('INPUT');
for (zxc0=0;zxc0<zxccbs.length;zxc0++){
if (zxccbs[zxc0].type=='checkbox'&&zxccbs[zxc0].checked){
document.getElementById(id).value=zxccbs[zxc0].value;
if (!zxccbs[zxc0].set){
zxccbs[zxc0].set=true;
zxct.ary[zxct.ary.length]=zxccbs[zxc0];
}
}
}
zxcv=0
for (zxc1=0;zxc1<zxct.ary.length;zxc1++){
if (zxct.ary[zxc1].checked){
zxcv+=parseFloat(zxct.ary[zxc1].value);
}
}
zxct.value=zxcv;
}
</script>
</head>
<body onload="f6_OneCheckBox()">
<table border="1">
<TR><TD colspan="3"><table width="100%">
<TR><TD align='center'> <TD align='center'>P<TD align='center'>F</TD></TR>
</Table>
<tr onclick="zxcSubTotal(this,'Group1','Total');">
<td>1.
<td><input title="f6_Group1" type="checkbox" value="1"></td>
<td><input title="f6_Group1" type="checkbox" value="0"></td>
<input id="Group1"type="hidden" name=""></td>
</tr>
<tr onclick="zxcSubTotal(this,'Group2','Total');">
<td>2.
<td><input title="f6_Group2" type="checkbox" value="1" name=""></td>
<td><input title="f6_Group2" type="checkbox" value="0" name=""></td>
<input id="Group2"type="hidden" name=""></td>
</tr>
<tr onclick="zxcSubTotal(this,'Group3','Total');">
<td>3.
<td><input title="f6_Group3" type="checkbox" value="1" name=""></td>
<td><input title="f6_Group3" type="checkbox" value="0" name=""></td>
<input id="Group3"type="hidden" name=""></td>
</tr>
<tr onclick="zxcSubTotal(this,'Group4','Total');">
<td>4.
<td><input title="f6_Group4" type="checkbox" value="1" name=""></td>
<td><input title="f6_Group4" type="checkbox" value="0" name=""></td>
<input id="Group4"type="hidden" name=""></td>
</tr>
<tr onclick="zxcSubTotal(this,'Group5','Total');">
<td>5.
<td><input title="f6_Group5" type="checkbox" value="1" name=""></td>
<td><input title="f6_Group5" type="checkbox" value="0" name=""></td>
<input id="Group5"type="hidden" name=""></td>
</tr>
<tr onclick="zxcSubTotal(this,'Group6','Total');">
<td>6.
<td><input title="f6_Group6" type="checkbox" value="1" name=""></td>
<td><input title="f6_Group6" type="checkbox" value="0" name=""></td>
<input id="Group6"type="hidden" name=""></td>
</tr>
<tr >
<td colspan=3 ><input id="Total"type="text" name="total" size=5 ></td>
</tr>
<TR><TD colspan="3"><INPUT type="text" size="5" name="passfail">
</table>
<script language="JavaScript" type="text/javascript">
<!--
function f6_OneCheckBox(){
f6_cbs=document.getElementsByTagName('INPUT');
for (f6_0=0;f6_0<f6_cbs.length;f6_0++){
if (f6_cbs[f6_0].title.substring(0,3)=='f6_'){
f6_cbs[f6_0].onclick=function(){ f6_CheckOnlyOne(this); }
}
}
}
function f6_CheckOnlyOne(f6_){
for (f6_0=0;f6_0<f6_cbs.length;f6_0++){
if (f6_cbs[f6_0].title==f6_.title&&f6_cbs[f6_0]!=f6_){
f6_cbs[f6_0].checked=false;
}
}
}
</script>
</body>
</html>