function make(tagname,attributes,children)
{
    var e= document.createElement(tagname);
    if(arguments.length==2&&(attributes instanceof Array||typeof attributes == "string"))
{  children = attributes;
   attributes = null;
}
if(attributes != null){
for(var name in attributes) 
   e.setAttribute(name,attributes[name]);
}
if(children!=null){
if(children instanceof Array){//instanceof 和 typeof 区别
        for(var i=0;i<children.length;i++)
{var child = children[i];
 if(typeof child=="string")
  var child = document.createTextNode(child);
 e.appendChild(child);

}
}
else if(typeof children == "string"){
     var c=children;
 var kids = document.createTextNode(children);
 kids.nodeValue = c;
 e.appendChild(kids);
//      e.appendChild(document.createTextNode(children));//变量 是不需要" "的!!
}  
else
     e.appendChild(children);
}
    return e;

var table = make("table",{border:1},make("tr",[make("th","Name"),make("th","Type"),make("th","Value")]));
var tr=table.firstChild;
var m=tr.childNodes;
for(var i=0;i<m.length;i++)
   document.write(m[i].nodeValue+" ");
//table.ID="id";
//document.write(table.ID)
</script>
<table ></table>
</body>
</html>
 document.write(m[i].nodeValue+" ");
我想输出我插入的表格对象的值。可是为空但是我已经对新插入的节点赋值了啊
else if(typeof children == "string"){
     var c=children;
 var kids = document.createTextNode(children);
 kids.nodeValue = c;
 e.appendChild(kids);
//      e.appendChild(document.createTextNode(children));//变量 是不需要" "的!!
}  
请大家帮我看看!!