学Js 有一段时间了。。但是感觉学的散散的,刚好看到实验室桌子上有本<<Javascript 高级程序设计 >> 就拿来看看 里面js 关于dom 基础的知识,就尝试了写。好吧。。其实我是要看正则表达式的。
<html>
<head>
<script type = "text/javascript">
function Test(){
//alert("11");
var table = document.createElement("table");
table.setAttribute("border","1");
table.setAttribute("width","100%");
var body = document.createElement("tbody");
table.appendChild(body);
body.insertRow(0);
body.rows[0].insertCell(0);
body.rows[0].cells[0].appendChild(document.createTextNode("1,1"));
body.rows[0].insertCell(1);
body.rows[0].cells[1].appendChild(document.createTextNode("1,2"));
document.body.appendChild(table);
}
</script>
</head>
<body onload = "Test()">
</body>
</html>