<script language="JavaScript">
//重写getElementById 兼容Ie 6 8 7 火狐
document.nativeGetElementById = document.getElementById;
document.getElementById = function(id)
{
var elem = document.nativeGetElementById(id);
if(elem) //兼容IE Version 6 7 8
{
//修改后的确认能得到id属性方法
if(elem.attributes['id'].value == id)
{
return elem;
}
else
{
if(document.getElementsByName(id)!=null&&document.getElementsByName(id).length>0)
{
return document.getElementsByName(id)[0];
}
}
}
else //兼容fox
{
if(document.getElementsByName(id)!=null&&document.getElementsByName(id).length>0)
{
return document.getElementsByName(id)[0];
}
}
return null;
};
</script>
//重写getElementById 兼容Ie 6 8 7 火狐
document.nativeGetElementById = document.getElementById;
document.getElementById = function(id)
{
var elem = document.nativeGetElementById(id);
if(elem) //兼容IE Version 6 7 8
{
//修改后的确认能得到id属性方法
if(elem.attributes['id'].value == id)
{
return elem;
}
else
{
if(document.getElementsByName(id)!=null&&document.getElementsByName(id).length>0)
{
return document.getElementsByName(id)[0];
}
}
}
else //兼容fox
{
if(document.getElementsByName(id)!=null&&document.getElementsByName(id).length>0)
{
return document.getElementsByName(id)[0];
}
}
return null;
};
</script>