<!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>关于结点的使用</title>
<style type="text/css">
</style>
<script language="javascript">
function addDIV()
{
var dt=document.getElementById("divTab");
var createDIV=document.createElement("div");
dt.appendChild(createDIV);
createDIV.setAttribute("id","newdiv");
var newdiv=document.getElementById("newdiv")
//newdiv.innerHTML="china";
var text=document.createTextNode("handson");
newdiv.appendChild(text);
function style1(){
this.color="#ff0000";
this.border="1px solid blue";
this.width="150px";
this.height="100px";
this.padding="10px";
this.font="40px 黑体";
}
var sty=new style1();
for(var p in sty)
{
newdiv.style[p]=sty[p];
}
alert(document.getElementsByTagName("div").length);
}
</script>
</head>
<body>
<div id="divTab" style="width: 300px; height: 200px; border: 1px solid #FF6600;"></div>
<input type="button" value="addTable" onclick="addDIV()" />
</body>
</html>