Posted in Javascript onOctober 01, 2011
var body = document.body; var html = document.documentElement; var div = document.createElement("div"); var p = document.createElement("p"); var ali = document.createTextNode("alipay"); p.appendChild(ali); div.appendChild(p); div.setAttribute("id","fn-div"); div.setAttribute("class","fn-class"); body.appendChild(div); var arr = div.attributes; for(var i=0;i<arr.length;i++){ console.log(arr[i].name + ":" + arr[i].value); }
Dom 结点创建 基础知识
声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@