I was using Firefox today and suddenly discovered a small problem. The former is used for IE and the latter is used for mozilla browser.
]
And the counts of rules and cssRules The methods are also different! rules is the selector number; cssRules is the rule number. You can see this by running the following code using IE and firefox respectively.
If you need to introduce external Js, you need to refresh to execute <script>
if(document.styleSheets[0].cssRules){
alert(document.styleSheets[0].cssRules[0].style.cssText)
}else{
alert(document.styleSheets[0].rules[0].style.cssText)
}
</script>]<script>
if(document.styleSheets[0].cssRules){
alert(document.styleSheets[0].cssRules[1].selectorText+":"+document.styleSheets[0].cssRules[1].style.cssText)
}else{
alert(document.styleSheets[0].rules[1].selectorText+":"+document.styleSheets[0].rules[1].style.cssText)
}
</script>