标签:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script src="js/jquery-1.12.0.min.js"></script>
</head>
<style type="text/css">
.alert {
padding: 15px;
margin-bottom: 20px;
border: 1px solid transparent;
border-radius: 4px;
}
.alert-warning {
color: #8a6d3b;
background-color: #fcf8e3;
border-color: #faebcc;
}
</style>
<script type="text/javascript">
function getExplorer() {
var explorer = window.navigator.userAgent;
//ie
if (explorer.indexOf("MSIE") >= 0) {
var browser = navigator.appName;
var b_version = navigator.appVersion;
var version = b_version.split(";");
var trim_Version = version[1].replace(/[ ]/g, "");
var number ="";
for (i = 0; i < trim_Version.length; i++) {
if ("0123456789".indexOf(trim_Version.substr(i, 1)) > -1)
number += trim_Version.substr(i, 1);
}
if (number < "8.0"){
if (trim_Version == "MSIE6.0" ) {
var divName = document.getElementById("tixing");
var text = "您的浏览器版本过低(当前浏览器版本为IE6),系统建议您采用高版本的主流浏览器!";
divName.innerHTML=text;
}
else if (trim_Version == "MSIE7.0" ) {
var divName = document.getElementById("tixing");
var text = "您的浏览器版本过低(当前浏览器版本为IE7),系统建议您采用高版本的主流浏览器!";
divName.innerHTML=text;
}
else if (trim_Version == "MSIE5.5" ) {
var divName = document.getElementById("tixing");
var text = "您的浏览器版本过低(当前浏览器版本为IE5),系统建议您采用高版本的主流浏览器!";
divName.innerHTML=text;
}else{
document.getElementById(‘tixing‘).style.display=‘none‘;
}
}else{
document.getElementById(‘tixing‘).style.display=‘none‘;
}
}
//firefox
else if (explorer.indexOf("Firefox") >= 0) {
document.getElementById(‘tixing‘).style.display=‘none‘;
}
//Chrome
else if (explorer.indexOf("Chrome") >= 0) {
document.getElementById(‘tixing‘).style.display=‘none‘;
}
//Opera
else if (explorer.indexOf("Opera") >= 0) {
document.getElementById(‘tixing‘).style.display=‘none‘;
}
//Safari
else if (explorer.indexOf("Safari") >= 0) {
document.getElementById(‘tixing‘).style.display=‘none‘;
}
}
window.onload = getExplorer;
</script>
<body>
<div class="alert alert-warning" id="tixing">
</div>
</body>
</html>
标签:
原文地址:http://www.cnblogs.com/airycode/p/5171225.html