javascript判断IE浏览器的版本
2012-09-01 14:05
274 查看
<!--IE浏览器兼容-->
<script language="javascript">
function ie(){
var isIE=!!window.ActiveXObject;
var isIE6=isIE&&!window.XMLHttpRequest;
var isIE8=isIE&&!!document.documentMode;
var isIE7=isIE&&!isIE6&&!isIE8;
if (isIE)
{
if (isIE6){
var style = document.createElement('link');
style.href = '/static/skins/ie7/skinIE6.css';
style.rel = 'stylesheet';
style.type = 'text/css';
document.getElementsByTagName('HEAD').item(0).appendChild(style);
alert("ie6");
}
else if (isIE8)
{
var style = document.createElement('link');
style.href = '/static/skins/ie7/skinIE7.css';
style.rel = 'stylesheet';
style.type = 'text/css';
document.getElementsByTagName('HEAD').item(0).appendChild(style);
alert("ie8");
}
else if (isIE7)
{
var style = document.createElement('link');
style.href = '/static/skins/ie7/skinIE7.css';
style.rel = 'stylesheet';
style.type = 'text/css';
document.getElementsByTagName('HEAD').item(0).appendChild(style);
alert("ie7");
}
}
}
//第一次页面的加载时候调用事件
if (window.addEventListener)
{
window.addEventListener("load", ie, false);
}
else if (window.attachEvent)
{
window.attachEvent("onload", ie);
}
else{
window.onload=ie;
}
</script>
<!--结束-->
<script language="javascript">
function ie(){
var isIE=!!window.ActiveXObject;
var isIE6=isIE&&!window.XMLHttpRequest;
var isIE8=isIE&&!!document.documentMode;
var isIE7=isIE&&!isIE6&&!isIE8;
if (isIE)
{
if (isIE6){
var style = document.createElement('link');
style.href = '/static/skins/ie7/skinIE6.css';
style.rel = 'stylesheet';
style.type = 'text/css';
document.getElementsByTagName('HEAD').item(0).appendChild(style);
alert("ie6");
}
else if (isIE8)
{
var style = document.createElement('link');
style.href = '/static/skins/ie7/skinIE7.css';
style.rel = 'stylesheet';
style.type = 'text/css';
document.getElementsByTagName('HEAD').item(0).appendChild(style);
alert("ie8");
}
else if (isIE7)
{
var style = document.createElement('link');
style.href = '/static/skins/ie7/skinIE7.css';
style.rel = 'stylesheet';
style.type = 'text/css';
document.getElementsByTagName('HEAD').item(0).appendChild(style);
alert("ie7");
}
}
}
//第一次页面的加载时候调用事件
if (window.addEventListener)
{
window.addEventListener("load", ie, false);
}
else if (window.attachEvent)
{
window.attachEvent("onload", ie);
}
else{
window.onload=ie;
}
</script>
<!--结束-->
相关文章推荐
- javascript判断IE浏览器版本
- javascript判断手机浏览器版本信息
- 通过JavaScript判断当前浏览器版本
- javascript判断浏览器类型与版本
- jQuery javaScript js 判断浏览器的类型、版本的方法
- 通用javascript代码判断版本号是否在版本范围之间
- JS判断是否为IE浏览器及IE版本
- JavaScript判断浏览器版本(未测试)
- JavaScript判断浏览器类型及版本
- JavaScript判断浏览器的类型和版本
- js判断是否是ie浏览器且给出ie版本
- 通过浏览器,javascript判断 ios 系统版本
- 用CSS如何判断IE浏览器版本?
- JavaScript判断浏览器类型及版本
- js方法判断ie浏览器版本
- ie浏览器判断及版本判断
- javascript判断浏览器类型与版本
- javascript 判断浏览器的ie版本,替换html标签
- jQuery javaScript js 判断浏览器的类型、版本的方法
- 在html中判断IE浏览器的版本