IE6内核浏览器判断和升级提醒(网站兼容性技巧)

学的记的

<!--[if lte IE 6]>
<div id="ie6-warning">您正在使用 Internet Explorer 6 内核浏览器,本站的显示效果可能有差异。强烈建议您升级到 Internet Explorer 8  <a href="http://www.microsoft.com/china/windows/internet-explorer/" target="_blank">【官方下载】</a> 帮助您以最佳效果浏览任何网站!
</div>
<style type="text/css">
        #ie6-warning{
        background:rgb(255,255,225) url("http://ued.taobao.com/images/warning.gif") no-repeat scroll 3px center;
        position:absolute;
        top:0;
        left:0;
        font-size:12px;
        color:#333;
        width:97%;
        padding: 2px 15px 2px 23px;
        text-align:left;
}
#ie6-warning a {
        text-decoration:none;
}
</style>
<script type="text/javascript">
function position_fixed(el, eltop, elleft){ 
        // check if this is IE6 
        if(!window.XMLHttpRequest) 
                window.onscroll = function(){ 
                        el.style.top = (document.documentElement.scrollTop + eltop)+"px"; 
                        el.style.left = (document.documentElement.scrollLeft + elleft)+"px"; 
        } 
        else el.style.position = "fixed"; 
}
        position_fixed(document.getElementById("ie6-warning"),0, 0);
</script>
<![endif]-->

Tags: IE6兼容  浏览器兼容  

5 Responses to "IE6内核浏览器判断和升级提醒(网站兼容性技巧)"

Leave a Reply

©Copyright 2008-归尘土 1meter.cn. Some Rights Reserved. Powered By Z-blog |
Login Feed Rss