合计的代码怎么写?有人能帮修改正确吗?
代码运行后如下图:

请在源代码中修改,谢谢。
<!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>
相关推荐
layui 开启自动合计,编辑后合计手动更新方法 以及表格外总时间表示问题
编辑后手动合计+总合计(显示在表格toolbar右上角)方法: 1,totalRow: true, //开启合计行 2,对应field开启合计,edit { field: 'test', title: 'test', unresize: true, align: 'center', width: 60, edit: 'text', totalRow: true}, 3,table.on('edit(XXX)', function (obj) { //XXX是HTML中的lay-fil...
element-ui表格单元格合并后数据出现偏移问题及导出后合计行错位
想要实现的效果 为了方便查看表格汇总数据,要求页面将合计数据加在列表第一行,前三个单元格合并,效果图如下: 下面是按官方文档实现 在el-table标签内加上 :span-method=“spanMethod” 属性,方法实现代码: spanMethod({ row, column, rowIndex, columnIndex }) { if (rowIndex === 0 && columnIndex === 0) { return { rowspan: 1,
全球检查台纸市场稳健增长:高频诊疗需求、产品升级与医疗供应链新机会.docx
全球检查台纸市场稳健增长:高频诊疗需求、产品升级与医疗供应链新机会
超音速扩散器空气动力学优化的MATLAB代码.zip
1.版本:matlab2014a/2019b/2024b 2.附赠案例数据可直接运行。 3.代码特点:参数化编程、参数可方便更改、代码编程思路清晰、注释明细。 4.适用对象:计算机,电子信息工程、数学等专业的大学生课程设计、期末大作业和毕业设计。
数字化转型最后一公里:AI如何打通企业技术需求对接瓶颈.docx
科易网基于40亿+科创知识图谱数据库,深度探索AI技术在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,研究科技创新领域的AI+数智化解决方案,推动科技创新与产业创新智能化发展。


