那位神人帮我把这段代码修改兼容所有浏览器啊。 在火狐浏览器下不滚动。
document.write("<div id=\"hasIE_level2\" style=\"background:#ffffee; text-align: center; padding:1px 0 1px; border:0 solid #ff0000;border-width:1px 0; width:100%; z-index:9999;margin-top:1px;position: absolute;bottom:0;left:0;height:18px;\"><div style=\"margin: 0px auto; width:980px;\"><div id=\"iewarning\" style=\"float:left;margin:-1px 0px 0 5px;\"><img align=\"absmiddle\" src=\"image/ii.gif\" border=\"0\" /></div><div id=\"closeimg\" style=\"width:19px; float:right;padding-right:5px;\"><a href=\"javascript:closediv('hasIE_level2');\" title=\"关闭提示\"><img src=\"image/xx.gif\" align=\"absmiddle\" border=\"0\" /></a></div><div style=\" margin-top:2px;font-size:12px;color:#000000\"> <a href=\"member.php?mod=gogoregister\" target=\"_blank\" style=\"text-decoration:none\">[免费注册]</a><font color=\"#FF0000\"><a href=\"http://openapi.qzone.qq.com/oauth/qzoneoauth_authorize?oauth_consumer_key=310247707&oauth_token=8522873991392139269&oauth_callback=http%253A%252F%252Fwww.haoshiyan.com%252Fconnect.php%253Fmod%253Dlogin%2526op%253Dcallback%2526referer%253Dportal.php\" target=\"_blank\" style=\"text-decoration:none\">[QQ登录]</a></font> <font color=\"#ff0000\">免费上门服务,免费法律援助,免费心理咨询!咨询QQ:<a target=\"_blank\" href=\"http://wpa.qq.com/msgrd?V=1&Uin=159591517&Site=在线咨询&Menu=yes\">159591517</a> (点击交谈) 电话:18688783983</font></div></div></div>");
function closediv(id) {
document.getElementById(id).style.display = 'none';
}
var g_myBodyInstance = document.body;
var g_myBodyInstanceString = "document.body";
if(document.compatMode != "BackCompat"){
// for looser.dtd
g_myBodyInstance = document.documentElement;
g_myBodyInstanceString = "document.documentElement";
}
var isMinNS4 = (navigator.appName.indexOf("Netscape") >= 0 &&
parseFloat(navigator.appVersion) >= 4) ? 1 : 0;
var isMinNS5 = (navigator.appName.indexOf("Netscape") >= 0 &&
parseFloat(navigator.appVersion) >= 5) ? 1 : 0;
var isMinIE4 = (document.all) ? 1 : 0;
var isMinIE5 = (isMinIE4 && navigator.appVersion.indexOf("5.") >= 0) ? 1 : 0;
var isMacIE = (isMinIE4 && navigator.userAgent.indexOf("Mac") >= 0) ? 1 : 0;
var getFFVersion=navigator.userAgent.substring(
navigator.userAgent.indexOf("Firefox")).split("/")[1];
//extra height in px to add to iframe in FireFox 1.0+ browsers
var FFextraHeight=getFFVersion<1.5? 16 : 0;
function getLayer(name) {
if (isMinNS5)
return document.getElementById(name);
else if (isMinIE4)
return eval('document.all.' + name);
else if (isMinNS4)
return findLayer(name, document);
return null;
}
function findLayer(name, doc) {
var i, layer;
for (i = 0; i < doc.layers.length; i++) {
layer = doc.layers[i];
if (layer.name == name)
return layer;
if (layer.document.layers.length > 0) {
layer = findLayer(name, layer.document);
if (layer != null)
return layer;
}
}
return null;
}
function moveLayerTo(layer, x, y) {
if (isMinIE4) {
layer.style.left = x;
layer.style.top = y;
}
else if (isMinNS5) {
layer.style.left = x+'px';
layer.style.top = y+'px';
}
else if (isMinNS4)
layer.moveTo(x, y);
}
function getPageLeft(layer) {
if (isMinIE4||isMinNS5)
return(layer.offsetLeft);
else if (isMinNS4)
return(layer.pageX);
return(-1);
}
function getPageTop(layer) {
if (isMinIE4||isMinNS5)
return(layer.offsetTop);
else if (isMinNS4)
return(layer.pageY);
return(-1);
}
function getPageScrollX() {
if (isMinIE4||isMinNS5)
return(g_myBodyInstance.scrollLeft);
else if (isMinNS4)
return(window.pageXOffset);
return(-1);
}
function getPageScrollY() {
if (isMinIE4||isMinNS5)
return(g_myBodyInstance.scrollTop);
else if (isMinNS4)
return(window.pageYOffset);
return(-1);
}
function getHeight(layer) {
if (isMinIE4||isMinNS5) {
if (false && layer.style.pixelHeight)
return(layer.style.pixelHeight);
else
return(layer.clientHeight);
}
else if (isMinNS4) {
if (layer.document.height)
return(layer.document.height);
else
return(layer.clip.bottom - layer.clip.top);
}
return(-1);
}
function getWindowHeight() {
if (isMinIE4||isMinNS5)
return(g_myBodyInstance.clientHeight);
else if (isMinNS4)
return(window.innerHeight);
return(-1);
}
var g_p_zealNavigatorBar = null;
g_p_zealNavigatorBar = getLayer('hasIE_level1');
g_p_zealNavigatorBar1 = getLayer('hasIE_level2');
if(!isMinIE4){g_p_zealNavigatorBar.style.position = 'fixcode';g_p_zealNavigatorBar1.style.position = 'fixcode';}
function reposzealNavigatorBar(){
if(isMinIE4){
try{
moveLayerTo(g_p_zealNavigatorBar1,
getPageLeft(g_p_zealNavigatorBar1),
getPageScrollY()+
getWindowHeight()-3-getHeight(g_p_zealNavigatorBar1));
}catch(e){}
}
}
window.onscroll = reposzealNavigatorBar;
window.onload = reposzealNavigatorBar;
|