function addClass(obj){
var thisClass=obj.parentNode.parentNode;
var num=thisClass.childNodes.length;
var newTable=document.createElement("table");
var newTr=document.createElement("tr");
var newTd=document.createElement("td");
var newText=document.createElement("textarea");
newText.style.borderTop="1px solid #D3E5F7";
newText.style.width="89%";
var creatTable=newTable.appendChild(newTr.appendChild(newTd.appendChild(newText)));
thisClass.childNodes[num-4].appendChild(creatTable);
thisClass.childNodes[num-5].appendChild(creatTable);
thisClass.childNodes[num-3].appendChild(creatTable);
thisClass.childNodes[num-2].appendChild(creatTable);
}
为什么我在用appendChild添加孩子时,明明是四个事件为什么只添加了一个。加急求解
如果需要可以qq教授
var thisClass=obj.parentNode.parentNode;
var num=thisClass.childNodes.length;
var newTable=document.createElement("table");
var newTr=document.createElement("tr");
var newTd=document.createElement("td");
var newText=document.createElement("textarea");
newText.style.borderTop="1px solid #D3E5F7";
newText.style.width="89%";
var creatTable=newTable.appendChild(newTr.appendChild(newTd.appendChild(newText)));
thisClass.childNodes[num-4].appendChild(creatTable);
thisClass.childNodes[num-5].appendChild(creatTable);
thisClass.childNodes[num-3].appendChild(creatTable);
thisClass.childNodes[num-2].appendChild(creatTable);
}
为什么我在用appendChild添加孩子时,明明是四个事件为什么只添加了一个。加急求解
如果需要可以qq教授
解决方案 »
- js实现页面转发功能
- 关于JS脚本验证表单元素是否为空的疑问,望懂的人解释下:document.要不要有什么区别呢?
- 求一个正则表达式检查必须是10位的字母,或者字母数字组合,不能是全数字,请高人指点,谢谢
- js juqery获取对象问题
- 菜鸟的疑惑,大哥们别笑话。
- goog dart vs typescript ???
- 关于键盘操控网页的问题,希望各位大大能看一下
- ++++++++++++++++请高手帮我写一个检测本地的mediaplayer是否可用的脚本
- showModalDialog 能有最大化图标吗
- 打印不提示,为什么在框架里打印时会报错?
- Jquery给元素同时绑定多个事件后产生的问题
- 设置组合快捷键
var thisClass=obj.parentNode.parentNode;
var num=thisClass.childNodes.length;
for(var i=4;i>=2;i--)
{
var newTable=document.createElement("table");
var newTr=document.createElement("tr");
var newTd=document.createElement("td");
var newText=document.createElement("textarea");
newText.style.borderTop="1px solid #D3E5F7";
newText.style.width="89%";
var creatTable=newTable.appendChild(newTr.appendChild(newTd.appendChild(newText)));
thisClass.childNodes[num-i].appendChild(creatTable);
}
估计这样可以
thisClass.childNodes[num-4].appendChild(creatTable.cloneNode());
[num-4] 这个是干嘛