判断浏览器是否为IE6,并执行层影藏,没有效果,求指点if (window.ActiveXObject) {
  var ua = navigator.userAgent.toLowerCase();
  var ie=ua.match(/msie ([\d.]+)/)[1]
if(ie==6.0){
$("#news").hide();
}
}

解决方案 »

  1.   

    <!--[if lte IE 6]><!--[else]>
    <div id="news"></div>
    <![endif]-->
      

  2.   


    if (window.ActiveXObject) {
      var ua = navigator.userAgent.toLowerCase();
      var ie=ua.match(/msie (\d+)\./)[1]
    if(ie==6){
    $("#news").hide();
    }
    }
      

  3.   


    都不行啊!
    #news还是没有影藏
      

  4.   

    var ms=navigator.userAgent.match(/msie\s+(\d+)/i);
    if(ms&&ms[1]==6)   $("#news").hide();
     
      

  5.   


    大侠,试了下
    #news我这个层就是顽固的存在上面,就是不隐藏
    发下html和css<div id="news">
    <div class="news_title">
    <span>消息通知</span>
    <a href="#" id="news_close"><img src="img/ts_close.gif" /></a>
    </div>
    <div class="news_main">
    <h3>您有凤凰读书币已到帐成功</h3>
    <ul>
    <li>神将三国(晋级任务第1步)<span>75凤凰读书币</span>已到帐。</li>
    <li>神将三国(晋级任务第1步)<span>75凤凰读书币</span>已到帐。</li>
    </ul>
    <p><a href="#">查看</a></p>
    </div>
    </div>#news{ width:426px; height:298px; background:url(../img/ts_bg_2.gif) no-repeat; position:fixed; right:0; bottom:0; z-index:100; overflow:hidden;}*html #news{ position:absolute;left:expression(eval(offsetParent.scrollLeft+100%));top:expression(eval(offsetParent.scrollTop+100%))}
    .news_title{ height:37px; line-height:37px; color:#FFF; padding:0 10px;}
    .news_title span{ float:left;}
    .news_title a{ float:right; margin-top:12px;}.news_main{ padding:10px;}
    .news_main h3{ font-size:24px; text-align:center; margin-bottom:20px;}
    .news_main ul{ height:140px;}
    .news_main ul li{ line-height:20px; font-family:"宋体"; padding:0 10px;}
    .news_main ul li span{ color:#f89b1e;}
    .news_main p{ text-align:right;}
    .news_main p a{ text-align:center; line-height:30px; background:url(../img/ts_btn_bg_2.gif) no-repeat; width:89px; height:30px; display:inline-block; color:#FFF;}
      

  6.   

     <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script><div id="news">
    <div class="news_title">
    <span>消息通知</span>
    <a href="#" id="news_close"><img src="img/ts_close.gif" /></a>
    </div>
    <div class="news_main">
    <h3>您有凤凰读书币已到帐成功</h3>
    <ul>
    <li>神将三国(晋级任务第1步)<span>75凤凰读书币</span>已到帐。</li>
    <li>神将三国(晋级任务第1步)<span>75凤凰读书币</span>已到帐。</li>
    </ul>
    <p><a href="#">查看</a></p>
    </div>
    </div>
    2秒后隐藏
    <script>
    setTimeout(function(){  if( $.browser.msie &&  $.browser.version==6) $('#news').hide()
     
    },2000)
    </script>
      

  7.   


    把我现在这写的复制存为html文件,100%可以<html><head><!--[if lte IE 6]>
    <style>
    .news
    {
       display:none
    }</style>
    <![endif]-->
    <style>
    .news
    {
    /*这里写非IE6的样式*/
    }
    </style></head>
    <div id="news"  class="news">
    不是IE6,所以我出来了</div>
    </html>