0
即時通訊創建一個樣式表與JS和附加一些規則,但它不會工作。創建樣式和插入規則/ addRule
if (style == null) {
var style = document.createElement('style');
style.setAttribute('type', 'text/css');
style.setAttribute('data-style', 13);
if (style.styleSheet) {
style.styleSheet.cssText = '';
} else {
style.appendChild(document.createTextNode(''));
}
document.head.appendChild(style);
}
if (typeof style.insertRule === 'function') {
style.insertRule("main > section[data-y='0']{top: 200px;}");
} else if (typeof style.addRule === 'function') {
style.addRule("main > section[data-y='0']", "{top: 200px;}");
}
對不起,即時通訊新的。
有人可以告訴我爲什麼這不會工作?