标签:
1、creatTextNode兼容
function fn(code){
var script = document.createElement("script");
script.type = "text/javascript";
try{
script.appendChild(document.createTextNode(code)); //IE9下不兼容
}catch(ex){
script.text = code ;
};
document.body.appendChild(script);
};
fn("alert(1)");
标签:
原文地址:http://www.cnblogs.com/xiaowan-/p/5611818.html