问题:
透明背景png图片,ie6中显示边框。
解决:
png有两种格式,IE6只支持较早版本的格式。
问题:
判断浏览器版本,跳转不同链接。
解决:
在body之间,插入如下,判断是否为IE浏览器
<script type="text/javascript"> var Sys = {}; var ua = navigator.userAgent.toLowerCase(); var s; (s = ua.match(/msie ([\d.]+)/)) ? Sys.ie = s[1] : if(Sys.ie){ window.location ="你的网址"; } else{ window.location ="你的网址"; } </script>
如果进一步确定浏览器类型,如Google chrome、Firefox、Opera、Safari等
<script type="text/javascript"> var Sys = {}; var ua = navigator.userAgent.toLowerCase(); var s; (s = ua.match(/msie ([\d.]+)/)) ? Sys.ie = s[1] : (s = ua.match(/firefox\/([\d.]+)/)) ? Sys.firefox = s[1] : (s = ua.match(/chrome\/([\d.]+)/)) ? Sys.chrome = s[1] : (s = ua.match(/opera.([\d.]+)/)) ? Sys.opera = s[1] : (s = ua.match(/version\/([\d.]+).*safari/)) ? Sys.safari = s[1] : 0; if(Sys.ie){ window.location ="你的地址"; } //else if(Sys.chrome){window.location ="你的地址";} //else if(Sys.opera){window.location ="你的地址";} //else if(Sys.firefox){window.location ="你的地址";} //else if(Sys.safari){window.location ="你的地址";} else{ window.location ="你的地址"; } </script>问题:
判断IE浏览器版本。
解决:
条件注释:如果IE8则百度,小于等于IE7则谷歌
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
自动跳转测试
<!--[if IE 8]> <script type="text/javascript"> window.location="http://www.baidu.com"; </script> <![endif]--><!--[if lte IE 7]> <script type="text/javascript"> window.location="http://www.google.com"; </script> <![endif]-->
注:
条件注释-lte:小于等于;lt:小于;gte:大于等于;gt:大于;[if !IE]:不是IE;[if IE]:是IE
判断网页是否IE8,如果是正常显示,不是则跳转到百度
<script type="text/javascript" language="javascript"> function getIE() { if(navigator.appName == "Microsoft Internet Explorer") { if(navigator.appVersion.match(/8./i)=='8.') { } else { location.href='http://www.baidu.com'; } } } </script>
判断是否IE8及以上,正常跳转,低于IE8则跳转百度。
<script type="text/javascript" language="javascript"> function getIE() { if(navigator.appName == "Microsoft Internet Explorer") { if(navigator.appVersion.match(/8./i)=='8.' || navigator.appVersion.match(/9./i)=='9.') { } else { location.href='http://www.baidu.com'; } } } </script>
判断IE6,指定使用的CSS样式
<script type="text/javascript"> //识别是否使用IE浏览器 if(navigator.userAgent.indexOf("MSIE")>0) { //判断结果为IE8.0 则使用ie8.CSS if(navigator.userAgent.indexOf("MSIE 8.0")>0) { Css.innerHTML='<link href="path/ie8.css" rel="stylesheet" type="text/css" >' } //判断结果为IE6.0 则使用ie6.CSS if(navigator.userAgent.indexOf("MSIE 6.0")>0) { Css.innerHTML='<link href="path/ie6.css" rel="stylesheet" type="text/css" >' } //否则使用css.CSS }else { Css.innerHTML='<link href="path/css.css" rel="stylesheet" type="text/css" >' } </script>