<html>
<head>
<title>New Page 1</title>
</head>
<script>
function fn()
{for(var i=1;i<3;i++)'
eval("f1.c"+i).value=eval("f1.a"+i).value*1+eval("f1.b"+i).value*1
}
</script>
<body>
<form name="f1">
<table border="1" width="46%">
<tr>
<td width="23%"><input type="text" name="a1" size="20" value="1"></td>
<td width="77%"><input type="text" name="b1" size="20" value="1"></td>
<td width="77%"><input type="text" name="c1" size="20"></td>
</tr>
<tr>
<td width="23%"><input type="text" name="a2" size="20" value="2"></td>
<td width="77%"><input type="text" name="b2" size="20" value="2"></td>
<td width="77%"><input type="text" name="c2" size="20"></td>
</tr>
</table>
<input type="button" name="bu" size="20" value="确认" onclick="fn()">
</form>
</body>
</html>
<head>
<title>New Page 1</title>
</head>
<script>
function fn()
{for(var i=1;i<3;i++)'
eval("f1.c"+i).value=eval("f1.a"+i).value*1+eval("f1.b"+i).value*1
}
</script>
<body>
<form name="f1">
<table border="1" width="46%">
<tr>
<td width="23%"><input type="text" name="a1" size="20" value="1"></td>
<td width="77%"><input type="text" name="b1" size="20" value="1"></td>
<td width="77%"><input type="text" name="c1" size="20"></td>
</tr>
<tr>
<td width="23%"><input type="text" name="a2" size="20" value="2"></td>
<td width="77%"><input type="text" name="b2" size="20" value="2"></td>
<td width="77%"><input type="text" name="c2" size="20"></td>
</tr>
</table>
<input type="button" name="bu" size="20" value="确认" onclick="fn()">
</form>
</body>
</html>
解决方案 »
- EXTjs gird 如何在冻结列的前面加上复选框【高分】
- 如何防止窗口最小化
- dwr 配置问题
- AdobeDreamweaverCS4怎么运行JavaScript代码?
- 怎样判断一个元素是否存在?
- 使用TextArea控件,怎样才能让滚动条总在最下面,是否能够实现?必须用div或者是iframe?
- each 循环打断不启作用??
- 急求 基于JSP和ACCESS设计的个人博客网站
- 问一个有关js的问题 ,我的所有绑定弹出都无效 ,只有写在标签里才有效
- angular cli 生成的工程 ng serve的时候运行到95% emitting LicenseWebpackPlugin卡住。
- 当前页判断:保证“下拉框选择的内容不能为空”的问题
- 隐藏显示行问题
<html>
<head>
<title>New Page 1</title>
</head>
<script>
function fn()
{for(var i=1;i<3;i++)//这里的3表示有2组,如果100组则为101
eval("f1.c"+i).value=eval("f1.a"+i).value*1+eval("f1.b"+i).value*1
}
</script>
<body>
<form name="f1">
<table border="1" width="46%">
<tr>
<td width="23%"><input type="text" name="a1" size="20" value="1"></td>
<td width="77%"><input type="text" name="b1" size="20" value="1"></td>
<td width="77%"><input type="text" name="c1" size="20"></td>
</tr>
<tr>
<td width="23%"><input type="text" name="a2" size="20" value="2"></td>
<td width="77%"><input type="text" name="b2" size="20" value="2"></td>
<td width="77%"><input type="text" name="c2" size="20"></td>
</tr>
</table>
<input type="button" name="bu" size="20" value="确认" onclick="fn()">
</form>
</body>
</html>
<html>
<head>
<title>New Page 1</title>
</head>
<script>
function fn()
{
var row = document.all.tab.rows;
for(var i=0;i<row.length;i++)
{
row[i].childNodes[2].childNodes[0].value = parseInt(row[i].childNodes[0].childNodes[0].value) + parseInt(row[i].childNodes[1].childNodes[0].value);
}
}
</script>
<body>
<form name="f1">
<table border="1" width="46%" id="tab">
<tr>
<td width="23%"><input type="text" name="a1" size="20"></td>
<td width="77%"><input type="text" name="b1" size="20"></td>
<td width="77%"><input type="text" name="c1" size="20"></td>
</tr>
<tr>
<td width="23%"><input type="text" name="a2" size="20"></td>
<td width="77%"><input type="text" name="b2" size="20"></td>
<td width="77%"><input type="text" name="c2" size="20"></td>
</tr>
</table>
<input type="button" name="bu" size="20" value="确认" onclick="fn()">
</form>
</body>
</html>