Home >Web Front-end >JS Tutorial >javascript import css example code_javascript skills
I missed a semicolon (red) at the beginning, and it’s wrong no matter what I do.
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);