最后合计的代码怎么写?有人能帮修改正确吗?
代码运行后如下图:
请在源代码中修改,谢谢。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="content-Type" content="text/html;charset=gb2312">
<title></title>
</head>
<body>
<p>请在黄色框内输入数字,将自动计算合计。</p>
<table width="800" border="1" cellspacing="2" cellpadding="9">
<tr>
<th width="40" bgcolor="#CCCCCC" scope="col">次数</th>
<th width="40" bgcolor="#CCCCCC" scope="col">扣分</th>
<th width="40" bgcolor="#CCCCCC" scope="col">评分小计</th>
</tr>
</table>
<SCRIPT language="javascript">
function SumNum1()
{
var sumValue1
a=eval(_1.value);
b=0.1
if (isNaN(a))
{a=0}
sumValue1 = a*b;
self['_2'].value =sumValue1;
var sumValue2
a=eval(_1.value);
b=0.1
if (isNaN(a))
{a=0}
sumValue2 = 5-a*b;
self['_3'].value =sumValue2;
}
</script>
<table width="800" border="1" cellspacing="2" cellpadding="10">
<tr>
<th width="40" bgcolor="#FFFF00" scope="col"><input id="_1" type="text" size="5" onkeyup="value=value.replace(/[^\d\.]/g,'');SumNum1();"></th>
<th width="40" scope="col"><input id="_2" type="text" size="5"></th>
<th width="40" scope="col"><input id="_3" type="text" size="5"></th>
</tr>
</table>
<SCRIPT language="javascript">
function SumNum2()
{
var sumValue3
c=eval(_4.value);
d=0.5
if (isNaN(c))
{c=0}
sumValue3 = c*d;
self['_5'].value =sumValue3;
var sumValue4
c=eval(_4.value);
d=0.5
if (isNaN(c))
{c=0}
sumValue4 = 5-c*d;
self['_6'].value =sumValue4;
}
</script>
<table width="800" border="1" cellspacing="2" cellpadding="10">
<tr>
<th width="40" bgcolor="#FFFF00" scope="col"><input id="_4" type="text" size="5" onkeyup="value=value.replace(/[^\d\.]/g,'');SumNum2();"></th>
<th width="40" scope="col"><input id="_5" type="text" size="5"></th>
<th width="40" scope="col"><input id="_6" type="text" size="5"></th>
</tr>
</table>
<SCRIPT language="javascript">
function SumNum3()
{
var sumValue13
a3=eval(_13.value);
b3=0.2
if (isNaN(a3))
{a3=0}
sumValue13 = a3*b3;
self['_23'].value =sumValue13;
var sumValue23
a3=eval(_13.value);
b3=0.2
if (isNaN(a3))
{a3=0}
sumValue23 = 5-a3*b3;
self['_33'].value =sumValue23;
}
</script>
<table width="800" border="1" cellspacing="2" cellpadding="10">
<tr>
<th width="40" bgcolor="#FFFF00" scope="col"><input id="_13" type="text" size="5" onkeyup="value=value.replace(/[^\d\.]/g,'');SumNum3();"></th>
<th width="40" scope="col"><input id="_23" type="text" size="5"></th>
<th width="40" scope="col"><input id="_33" type="text" size="5"></th>
</tr>
</table>
<script type="text/javascript">
function add(){
// 如果不是数字,或者没有填写就默认为0
var var111 = parseFloat(document.getElementById(self['_3']).value) || 0;
var var222 = parseFloat(document.getElementById(self['_6']).value) || 0;
var var333 = parseFloat(document.getElementById(self['_33']).value) || 0;
document.getElementById('_39').value = var111 + var222 + var333;
}
</script>
<table width="800" border="1" cellspacing="2" cellpadding="10">
<tr>
<th width="30" scope="col">合计</th>
<th width="40" scope="col"><input id="_39" type="text" size="5"></th>
</tr>
</table>
</body>
</html>