function BtnOK_Click()
{
var Sum=0;
var n1,n2,n3,n4,n5;
n1=eval(document.form1.aa.value);
n2=eval(document.form1.bb.value);
n4=eval(document.form1.sum1.value);
n3=n1+n2+n4;
document.form1.sum2.value=n3
for(var i=0;i<10;i++)
{
if(form1.selField[i].checked)
Sum+=parseInt(form1.selField[i].value);
document.form1.sum1.value=Sum
}
}
</script>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><form name="form1" method="post" action="">
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td>表单1:
<input name="aa" type="text" id="aa" value="50" size="10">
表单2:
<input name="bb" type="text" id="bb" value="50" size="10"></td>
</tr>
<tr>
<td>
<input type="checkbox" name="selField" value="50">a1
<input type="checkbox" name="selField" value="50">a2
<input type="checkbox" name="selField" value="50">a3
<input type="checkbox" name="selField" value="50">a4
<input type="checkbox" name="selField" value="50">
a5 =
<input name="sum1" type="text" size="10"></td>
</tr>
<tr>
<td>总数:
<input name="sum2" type="text" size="20"></td>
</tr>
<tr>
<td><input type="button" name=BtnOK value="确定" onClick="BtnOK_Click();" ></td>
</tr>
</table>
</form></td>
</tr>
</table>
[此贴子已经被作者于2006-10-8 17:40:51编辑过]