js动态创建表格(createElement函数)

2016-02-22    编辑:kp12345     点击(

<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<title>网页特效动态创建表格(createelement函数)</title>
<script language="网页特效">
 var tb, tr, td, i, j, k;
 tb = document.createelement('table');
 tb.cellpadding = '0';
 for (i = j = 0; i < ctrls.length; i++) {
  if (typeof ctrls[i] == 'number') {
   if (ctrls[i] == 0) {
    tr = tb.insertrow(j++);
    k = 0;
   } else {
    td = tr.insertcell(k++);
    td.colspan = ctrls[i];
    td.nowrap = true;
   }
  } else {
   td.appendchild(ctrl(ctrls[i]));
  }
 }
 document.body.insertbefore(tb, document.body.firstchild);

 document.documentelement.style.height = '100%';
 document.documentelement.style.overflow = 'hidden';
 document.body.style.height = '100%';
 document.body.style.margin = '0';
</script>
</head>

<body>
</body>
</html>