复制代码代码如下:
<html>
<adal>
<cript>
Fonction CreateTable (lignes, lignes) {
this.Rows = lignes;
this.lines = lignes;
var body = document.getElementById ('corps');
var table = document.CreateElement ('Table'); // 创建 Table 标签元素
Table.setAttribute («bordure», «1»);
// 给 Tableau 标签添加其他属性
pour (var i = 0; i <this.Rows; i ++) {
var lrow = document.createElement ('tr');
pour (var j = 0; j <this.lines; j ++) {
var textNode = document.createTextNode (i + ',' + j);
var lline = document.createElement ('td');
lline.appendChild (textNode);
Lrow.ApendChild (Lline);
}
Table.ApendChild (lrow);
}
Body.ApendChild (tableau);
}
</cript>
</ head>
<body>
<div id = "body"> </ div>
</docy>
<script type = "text / javascript">
créatiable (10,10);
</cript>
</html>
:
复制代码代码如下:
<cript>
Fonction CreateTable (lignes, lignes) {
this.Rows = lignes;
this.lines = lignes;
var body = document.getElementById ('corps');
var table = document.CreateElement ('Table');
Table.setAttribute («bordure», 1);
pour (var i = 0; i <this.Rows; i ++) {
var row = table.insertrow (i);
pour (var j = 0; j <this.lines; j ++) {
var cellules = row.insertCell (j);
cells.innerhtml = i + ',' + j
}
}
Body.ApendChild (tableau);
}
</cript>