判断IE版本并给出提示升级浏览器(本文转自http://blog.csdn.net/zztp01/article/details/5820090)

 

本文转自http://blog.csdn.net/zztp01/article/details/5820090

<html>

  <head>
  <title>判断IE版本并给出提示升级浏览器</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <style type="text/css">
  #ie6-warning{
  background:rgb(255,255,225) url("背景图片地址") 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>
  <body>
  <br /><br />
  <!--[if lte IE 6]>
  <div id="ie6-warning">您正在使用 Internet Explorer 6,在本页面的显示效果可能有差异。建议您升级到 <a href="http://www.microsoft.com/china/windows/internet-explorer/" target="_blank">Internet Explorer 8</a> 或以下浏览器: <a href="http://www.mozillaonline.com/">Firefox</a> / <a href="http://www.google.com/chrome/?hl=zh-CN">Chrome</a> / <a href="http://www.apple.com.cn/safari/">Safari</a> / <a href="http://www.operachina.com/">Opera</a>
  </div>
  <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]-->
  </body>
  </html>

 

posted @ 2016-08-29 15:41  lexie  阅读(478)  评论(0编辑  收藏  举报