一开始少写了个分号(红色的),怎么搞都不对. var style = document.createElement("STYLE"); document.body.appendChild(style); style.onerror = function(){ alert("here1") } style.onreadystatechange = function(){ alert("here2"); } var sheet = style.styleSheet || style.sheet; if(sheet.addImport) sheet.addImport("aa.css"); else sheet.insertRule("@import url('aa.css');",sheet.cssRules.length);
推荐阅读
用js遍历 table的脚本
var tableObj = document.getElementById("tableName"); var str = ""; for(var i=0;i<tableObj.rows.length;i++) { for(varj=0;j<tableObj.rows[i].cells.length;j++) { //str += tableObj.rows[i].c>>>详细阅读
本文标题:javascript import css实例代码
地址:http://www.17bianji.com/kaifa2/JS/29541.html
1/2 1