It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center
                            
                        
                    
                
                                已关闭8年。
            
                    
我正在使用jquery addRule,但在IE9中无法正常工作,我如何解决此问题。任何帮助请

检查此代码

var ss=document.createStyleSheet();
ss.insertRule("v\\:shape", "behavior:url(#default#VML);")

最佳答案

jQuery没有.addRule()方法。仅> IE9支持the addRule method

您应该改用insertRule

编辑:实际上,您应该同时检查IE8和以下版本不支持insertRule

if (stylesheet.insertRule) {
  // all except IE < 9
} else if (stylesheet.addRule) {
  // IE < 9
}


假设stylesheet是您的样式表对象。

关于jquery - CSS在IE9中无法正常工作,但在所有其他版本中均可以正常工作,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/7645030/

10-13 00:40