消灭IE6!
在客户端的ie版本低于等于ie6的情况下,提示用户升级客户端,并将后台登入接口的链接不可用.
Index.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Index.aspx.cs" Inherits="DTLEntAdministration.Web.Index" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>驱动人生企业版</title> <link href="css/css.css" rel="stylesheet" type="text/css" /> <style type="text/css"> #ie6-warning{background:#FF0; position:absolute;top:0; left:0;font-size:12px; line-height:24px; color:#F00; padding:0 10px;} #ie6-warning img{float:right; cursor:pointer; margin-top:4px;} #ie6-warning a{text-decoration:none;} </style> </head> <body> <div class="xmian"> <asp:HyperLink ID="hlDownload" runat="server" Target="_blank" CssClass="anniu"><img alt="" src="images/x_ico.jpg" width="142" height="52" /></asp:HyperLink> <a id="loadadmin" href="#" target="_self" class="dl">登录后台管理</a> <script type="text/javascript"> var togo = 1; </script> <!--[if lte IE 6]> <div id="ie6-warning"> <img src="images/cha.jpg" width="14" height="14" onclick="closeme();" alt="关闭提示" /> 您正在使用 Internet Explorer 6 低版本的IE浏览器。为更好的浏览本页,建议您将浏览器升级到 <a href="http://www.microsoft.com/china/windows/internet-explorer/ie8howto.aspx" target="_blank">IE8</a> 或以下浏览器:<a href="http://www.firefox.com.cn/download/">Firefox</a> / <a href="http://www.google.cn/chrome"> Chrome</a> / <a href="http://www.apple.com.cn/safari/">Safari</a> / <a href="http://www.Opera.com/">Opera</a> </div> <script type="text/javascript"> togo = 0; function closeme(){ var div = document.getElementById("ie6-warning"); div.style.display ="none"; }; 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]--> <script type="text/javascript"> if (togo === 1) document.getElementById("loadadmin").href = 'Home.aspx'; </script> </div> </body> </html>
在ie6及以下版本显示效果如下:
在ie6以上的版本或者其他非ie内核的浏览器下则显示如下:
同时登录后台管理的链接可用.