————————————————————

<script type="text/javascript">
            //body加载事件监听函数
            function chooseCss(){
                //这里我们假设ie使用css1,而其他浏览器使用css2
                //如果浏览器为IE浏览器
                if (window.navigator.userAgent.indexOf("MSIE")>=1){
                    //把的样式1禁用掉
                    document.styleSheets[1].disabled = true;        
                }else if (window.navigator.userAgent.indexOf("Firefox")>=1){
                //如果浏览器为firefox
                    //把的样式1禁用掉
                    document.styleSheets[0].disabled = true;    
                }else{
                //如果浏览器为其他,比如chrome
                    //把的样式1禁用掉
                    document.styleSheets[0].disabled = true;    
                }                
            }
        </script>

————————————————————————

<body style="text-align:center" onload="chooseCss();">
        <span >测试文本</span>
    </body>

————————————————————

 

相关文章:

  • 2021-05-19
  • 2022-12-23
  • 2022-12-23
  • 2022-03-04
  • 2022-12-23
  • 2021-06-11
  • 2022-01-09
  • 2021-11-22
猜你喜欢
  • 2022-12-23
  • 2021-08-27
  • 2022-12-23
  • 2022-01-16
  • 2022-02-01
  • 2022-02-25
相关资源
相似解决方案