<script language="JavaScript">
<!--
//该函数的主要功能是判断浏览器版本和功能的.
function hasSupport() {
//判断是否已经调用过该函数给hasSupport.support赋值,如果已经赋值则返回值.
if (typeof hasSupport.support != "undefined")
return hasSupport.support;
//判断是不是IE5.5
var ie55 = /msie 5\.[56789]/i.test( navigator.userAgent );
//如果浏览器支持html1.0的功能,或者版本为IE5.5+,表示支持,把true给hasSupport.support,否则false
hasSupport.support = ( typeof document.implementation != "undefined" &&
document.implementation.hasFeature( "html", "1.0" ) || ie55 )
// IE55 has a serious DOM1 bug... Patch it!
//在IE55中的getElementsByTagName有一个bug,修复一下
if ( ie55 ) {
document._getElementsByTagName = document.getElementsByTagName;
//其实就是重写了一下getElementsByTagName函数,在参数为*的时候,返回所有节点
document.getElementsByTagName = function ( sTagName ) {
if ( sTagName == "*" )
return document.all;
else
return document._getElementsByTagName( sTagName );
};
}
//返回值,不用说了吧
return hasSupport.support;
}//-->
</script>
<!--
//该函数的主要功能是判断浏览器版本和功能的.
function hasSupport() {
//判断是否已经调用过该函数给hasSupport.support赋值,如果已经赋值则返回值.
if (typeof hasSupport.support != "undefined")
return hasSupport.support;
//判断是不是IE5.5
var ie55 = /msie 5\.[56789]/i.test( navigator.userAgent );
//如果浏览器支持html1.0的功能,或者版本为IE5.5+,表示支持,把true给hasSupport.support,否则false
hasSupport.support = ( typeof document.implementation != "undefined" &&
document.implementation.hasFeature( "html", "1.0" ) || ie55 )
// IE55 has a serious DOM1 bug... Patch it!
//在IE55中的getElementsByTagName有一个bug,修复一下
if ( ie55 ) {
document._getElementsByTagName = document.getElementsByTagName;
//其实就是重写了一下getElementsByTagName函数,在参数为*的时候,返回所有节点
document.getElementsByTagName = function ( sTagName ) {
if ( sTagName == "*" )
return document.all;
else
return document._getElementsByTagName( sTagName );
};
}
//返回值,不用说了吧
return hasSupport.support;
}//-->
</script>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货