document.body.all是什么意思,结合下面那个小函数谈一谈,谢谢
functiondoCal(obj){varnum=obj.value;vartbl=document.getElementById("id_tbl");if(docum...
function doCal(obj) {
var num = obj.value;
var tbl = document.getElementById("id_tbl");
if (document.body.all)
{
tbl.innerText = "";
}
else
{
tbl.innerHTML = "";
}
if (isNaN(num) || num.trim() == "")
{
return;
}
for (var i = 1; i <= num; i++)
{
var newRow = tbl.insertRow(tbl.rows.length);
for (var j = 1; j <= i; j++)
{
var newCell = document.createElement("td");
newCell.innerHTML = i + "*" + j + " = " + i * j;
newRow.appendChild(newCell);
}
for (j; j <= num; j++)
{
var newCell = document.createElement("td");
newCell.innerHTML = " ";
newRow.appendChild(newCell);
}
}
}
String.prototype.trim = function() {
return this.replace(/(^\s*)|(\s*$)/g, "");
};
tbl.innerText = ""
tbl.innerHTML = "";
这两句是什么意思啊 展开
var num = obj.value;
var tbl = document.getElementById("id_tbl");
if (document.body.all)
{
tbl.innerText = "";
}
else
{
tbl.innerHTML = "";
}
if (isNaN(num) || num.trim() == "")
{
return;
}
for (var i = 1; i <= num; i++)
{
var newRow = tbl.insertRow(tbl.rows.length);
for (var j = 1; j <= i; j++)
{
var newCell = document.createElement("td");
newCell.innerHTML = i + "*" + j + " = " + i * j;
newRow.appendChild(newCell);
}
for (j; j <= num; j++)
{
var newCell = document.createElement("td");
newCell.innerHTML = " ";
newRow.appendChild(newCell);
}
}
}
String.prototype.trim = function() {
return this.replace(/(^\s*)|(\s*$)/g, "");
};
tbl.innerText = ""
tbl.innerHTML = "";
这两句是什么意思啊 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询