一个比较烦人的脚本控制功能,请大家发表意见 没有什么捷径吧,技巧在于你的TEXT NAME了 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 把text的name用二维数组表示,然后做循环 将text放入表格中,然后循环计算该表中的text!因为很容易通过td获取其中的text<table id=tab1><tr><td><input type=text></td><td><input type=text></td></tr><tr><td><input type=text></td><td><input type=text></td></tr></table><script>var oTR = oTD = null;for(var iRow = 0; iRow < tab1.rows.length; iRow++){ oTR = tab2.rows(i); for(var iCol = 0; iCol < oTR.cells.length; iCol++){ oTD = oTR.childNodes(0); oInput = oTD.childNodes(0); // 进行oInput.value 的操作 }}</script> Sorry! :( oTR = tab2.rows(i); == > oTR = tab2.rows(iRow); oTD = oTR.childNodes(0); == > oTD = oTR.childNodes(iCol); function showtotal1(txt1,txt2,txt3,txt4,txt5,txt6,txt7,txt8,txt9){ document.getElementById(txt9).value=parseInt(document.getElementById(txt1).value)+parseInt(document.getElementById(txt2).value)+parseInt(document.getElementById(txt3).value)+parseInt(document.getElementById(txt4).value)+parseInt(document.getElementById(txt5).value)+parseInt(document.getElementById(txt6).value)+parseInt(document.getElementById(txt7).value)+parseInt(document.getElementById(txt8).value); var count=0; if(document.expense_applymodify.hid.length>0) { for(var i=0;i<document.expense_applymodify.hid.length;i++) { var index=2; index=index+i; count+=eval(document.all('DataGrid1__ctl'+index+'_totals').value); } } else { count+=eval(document.all('DataGrid1__ctl2_totals').value); } document.expense_applymodify.allmoney.value=count;} 关于分页问题 javascript 类定义和方法定义的问题 大胆问个问题,,JS 可以生成带文字图片么? javascript中如何拼接字符串? 请教无刷新更新数据后的数据按table的固定格式显示 下拉菜单问题 是关于 js 操作 style 的一个简单问题 90分全压了 怎么样动动态添加Select中的下拉列表中的内容 一个菜鸟的问题,怎么在JavaScript的函数中加入vbscript语言? 如何实现使用javascript调用服务器对象? 框架网页中页面自动刷新的问题 如何通过JS来控制打印机的横向设置呢?
因为很容易通过td获取其中的text<table id=tab1>
<tr><td><input type=text></td><td><input type=text></td></tr>
<tr><td><input type=text></td><td><input type=text></td></tr>
</table><script>
var oTR = oTD = null;
for(var iRow = 0; iRow < tab1.rows.length; iRow++){
oTR = tab2.rows(i);
for(var iCol = 0; iCol < oTR.cells.length; iCol++){
oTD = oTR.childNodes(0);
oInput = oTD.childNodes(0);
// 进行oInput.value 的操作
}
}
</script>
oTD = oTR.childNodes(0); == > oTD = oTR.childNodes(iCol);
{
document.getElementById(txt9).value=parseInt(document.getElementById(txt1).value)+parseInt(document.getElementById(txt2).value)+parseInt(document.getElementById(txt3).value)+parseInt(document.getElementById(txt4).value)+parseInt(document.getElementById(txt5).value)+parseInt(document.getElementById(txt6).value)+parseInt(document.getElementById(txt7).value)+parseInt(document.getElementById(txt8).value);
var count=0;
if(document.expense_applymodify.hid.length>0)
{
for(var i=0;i<document.expense_applymodify.hid.length;i++)
{
var index=2;
index=index+i;
count+=eval(document.all('DataGrid1__ctl'+index+'_totals').value);
}
}
else
{
count+=eval(document.all('DataGrid1__ctl2_totals').value);
}
document.expense_applymodify.allmoney.value=count;
}