javascript循环问题
functionf1(){row=document.getElementById("one").value;varcolumn=document.getElementBy...
function f1() {
row = document.getElementById("one").value;
var column = document.getElementById("two").value;
div1 = document.getElementById("div1");
div2 = document.getElementById("div2");
for (var i = 0; i < row; i++) {
tr = document.createElement("input");
tr.type = "text";
div1.appendChild(tr);
for (var i = 0; i < column; i++) {
var td = document.createElement("input");
td.type = "text";
div2.appendChild(td);
};
}
}
见javascript第一循环只会循环一次,如果把二层循环给删除有不会这样,求解? 展开
row = document.getElementById("one").value;
var column = document.getElementById("two").value;
div1 = document.getElementById("div1");
div2 = document.getElementById("div2");
for (var i = 0; i < row; i++) {
tr = document.createElement("input");
tr.type = "text";
div1.appendChild(tr);
for (var i = 0; i < column; i++) {
var td = document.createElement("input");
td.type = "text";
div2.appendChild(td);
};
}
}
见javascript第一循环只会循环一次,如果把二层循环给删除有不会这样,求解? 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询