<html>
<head></head>

<body onload="aa()">

<table id = "MyTableBoyd" name = "MyTableBoyd"  border="1"><tr><td>aa</td></tr></table>
<form ></form>
</body>
</html>

<script >
function aa() {
alert("ok");
 //这是IE和Firefox,Safari,Opera都支持的代码

var cell = document.createElement("td").appendChild(document.createTextNode("foo"));
cell.innerHTML = "aa";
alert("cell is :" + cell);

var row = document.createElement("tr").appendChild(cell);

alert("row is :" + row);
document.getElementById("MyTableBoyd").appendChild(row);

alert("end");
}

var button = document.createElement("input");

button.setAttribute("type","button");

document.getElementById("form").appendChild(button);

var li =  document.createElement("li");
li.innerHTML = "textLI";

var ul =  document.createElement("ul");

ul.appendChild(li);
document.getElementById("form").appendChild(ul);


</script>

相关文章:

  • 2021-11-21
  • 2021-12-12
  • 2021-10-22
  • 2021-10-10
  • 2021-10-16
  • 2021-05-18
  • 2022-12-23
猜你喜欢
  • 2021-04-20
  • 2021-10-18
  • 2021-09-23
  • 2022-02-06
  • 2022-01-19
  • 2021-08-01
  • 2021-10-19
相关资源
相似解决方案