在加载我的页面之前,我想对类样式进行一些修改。样式类包含在MyStyle.css
.divNew {
float: left;
margin: 10px 5px 5px 25px;
}
并加载一个新页面,我想修改/重载边距并添加高度。有什么建议吗?这是我尝试过的:
function pageLoad() {
var theRules = new Array();
if (document.styleSheets[0].cssRules) {
theRules = document.styleSheets[0].cssRules;
} else if (document.styleSheets[0].rules) {
theRules = document.styleSheets[0].rules;
}
for (n in theRules) {
if (theRules[n].selectorText == 'divNew') { ? ? ? ?
}
}
}