给ie浏览器添加推荐浏览器提示

  <script type="text/javascript">
        var isIE = !!window.ActiveXObject;
        var isIE6 = isIE && !window.XMLHttpRequest;
        var isIE8 = isIE && !!document.documentMode;
        var isIE7 = isIE && !isIE6 && !isIE;
        var Enabled = true;
        $(window).load(function () {
            if (Enabled) {
                var broTip = $("#browserTip");
                if (broTip.length < 1 && (isIE6 || isIE7 || isIE8)) {
                    $("body").children().first().before("<div id=\"browserTip\" style=\"width:100%;height:25px;display:none;line-height:25px;background-color: #FFF1B4;text-align:center;font-size: 13px;color:#000;border: none;box-shadow: 0 2px 4px rgba(0,0,0,0.3);\">亲,你的浏览器不太好哦,为了获得更好的体验效果,建议使用<a href=\"/resource/chrome28.exe\" style=\"color:red;text-decoration:underline\">谷歌浏览器</a>或<a style=\"color:red;text-decoration:underline\" href=\"/resource/Firefox_22.0.exe\">火狐浏览器</a>浏览本网站     <a style='color:#005eac;;text-decoration: none;' href=\"javascript:CloseVersionTip()\">立即关闭</a></span></div>");
                    $("#browserTip").slideDown();
                    setTimeout(CloseVersionTip, 5000);
                } else {
                    $("#browserTip").slideDown();
                    setTimeout(CloseVersionTip, 10000);
                }
            } 
        });
        function CloseVersionTip() {
            var broTip = $("#browserTip");
            if (broTip) {
                $("#browserTip").slideUp();
            }
        }
    </script>

  

posted @ 2013-11-14 22:42  Ganler1988  阅读(499)  评论(0编辑  收藏  举报