一个function,没有循环但是老是循环两次 老大,代码哪里出了问题,把问题代码贴出来就行了,实在不能精简的,也要注释一下吧!其实,你在代码精简的同时,往往自己就发现问题之所在了,真的!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 方法功能是这样的: 有一个id为report_table2的表,现在表的第一行id是guest_tr,第二行id是host2,一点提交按钮触发这个info()方法,先判断第一行是不是空,如果不是,取出第一行第二行的每个单元格的name之类的属性拼成一个字符串,以下细节没有什么问题,就是不明白,这个方法总是要循环两次,所有得到的字符串总是重复两遍的function info(){ row = document.getElementById("host2"); var objtr1=document.getElementById("guest_tr"); var oTbody=report_table2.children.item(0); if(objtr1.children.item(2)==undefined) { alert("不能为空!); return false; } else { for(var j=2;j<objtr1.children.length;j++) { if(row.children.item(j-1+cnum).name==undefined) hinfo=0; else { hinfo=objtr1.children.item(j).colSpan; cnum+=(hinfo-1); } hostinfo+=objtr1.children.item(j).name+"#"+hinfo+"@"; } hostinfo+="/"; for(var j1=1;j1<row.children.length;j1++) { if(row.children.item(j1).name!=undefined) hostinfo+=row.children.item(j1).name+"#"+"0"+"@"; else hostinfo=hostinfo; } hostinfo=hostinfo.substring(0,hostinfo.length-1); return true; } } js或jquery怎么获取文件路径,大家进来看看 小问题 修改一个js脚本 这段代码怎么写 都写不好啊 点击超级链接关闭母窗体 输入四位数字后自动填补冒号,并验证这时间格式是否正确。这正则表达式有点儿难度哟。 javascript怎么调用javascript!!!!!!!!!! 请问哪里有“日期选择的控件”的javascript 源代码?非常急!在线等!谢谢!!! 怎么在html页面中限制用户输入的数字是在小数点后两位? js 这个问题怎样理解 闭包?自执行? 为什么gridview控件没有数据时整个控件不显示 如何在一个页面显示N个计时器?
有一个id为report_table2的表,现在表的第一行id是guest_tr,第二行id是host2,一点提交按钮触发这个info()方法,先判断第一行是不是空,如果不是,取出第一行第二行的每个单元格的name之类的属性拼成一个字符串,以下细节没有什么问题,就是不明白,这个方法总是要循环两次,所有得到的字符串总是重复两遍的
function info()
{
row = document.getElementById("host2");
var objtr1=document.getElementById("guest_tr");
var oTbody=report_table2.children.item(0);
if(objtr1.children.item(2)==undefined)
{
alert("不能为空!);
return false;
}
else
{
for(var j=2;j<objtr1.children.length;j++)
{
if(row.children.item(j-1+cnum).name==undefined)
hinfo=0;
else
{
hinfo=objtr1.children.item(j).colSpan;
cnum+=(hinfo-1);
}
hostinfo+=objtr1.children.item(j).name+"#"+hinfo+"@";
}
hostinfo+="/";
for(var j1=1;j1<row.children.length;j1++)
{
if(row.children.item(j1).name!=undefined)
hostinfo+=row.children.item(j1).name+"#"+"0"+"@";
else
hostinfo=hostinfo;
}
hostinfo=hostinfo.substring(0,hostinfo.length-1);
return true;
}
}