zoukankan      html  css  js  c++  java
  • 一起来灭掉IE6!

    相信写过网页的,无不对IE6恨之露骨,没办法,无数GHOST装XP,直接就是IE6,这部分用户还是那么可观啊。有时候真想不兼容IE6了,直接给个“你用的浏览器太低级,请升级”的提示。如果你的网页已经完成,却发现IE6显示乱了,而你实在不想去兼容了,那就加一段下面的代码吧,为消灭IE6做点贡献。

    1、html结束后,加代码

    <!--[if lte IE 6]>
    <style type="text/css">
        #ie6-warning {text-align: center; background: red; filter: alpha(opacity=50); position: absolute; top: 0; left: 0; font-size: 12px; 100%; padding: 2px 0; }
        #ie6-warning a {text-decoration: none; color: #fff; }
    </style>
    <div id="ie6-warning">
        <a href="http://www.microsoft.com/china/windows/internet-explorer/" target="_blank">
            您正在使用 Internet Explorer 6,低版本的IE浏览器在本页面的显示效果可能有差异。 点击这里升级到 Internet Explorer 8
        </a>
    </div>
    <script src="@Url.Content("~/Scripts/IE8.js")" type="text/javascript"></script>
    <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]-->

    2、如果顶端是flash的话,加上这行,让它透明。否则不用

    <param name="wmode" value="transparent" />

    完成以上工作后,用户用IE6打开,就会在顶端浮动一行文字提示,能提示用户又不影响正常浏览,真希望所有的网站都在用户使用IE6的时候都这样做,为快速消灭IE6做份贡献!

  • 相关阅读:
    dom4j解析xml字符串实例
    使用Dom4j生成xml文件(utf-8编码)
    viewer.js插件简单使用说明
    html标签title属性效果优化
    XML文件读写编码不是UTF-8的问题
    webservice wsdl文件标签讲解
    定销房概念扫盲
    Sql Server系列:视图
    Centos7安装mysql5.6
    java实现链式队列
  • 原文地址:https://www.cnblogs.com/yvesliao/p/2033650.html
Copyright © 2011-2022 走看看