这段javascript代码在IE浏览器下正常运行呢,在火狐就没效果了,请帮忙改一下
<style>html,body{height:100%;text-align:center;font-size:12px;color:#404040}.wp_sideb...
<style>
html,body{height:100%; text-align:center; font-size:12px; color:#404040}
.wp_sidebar{background:fff;width:230px; margin:30px auto; text-align:left;}
.mo_wp{ background:#F7F7F7; margin-bottom:4px;border:1px solid #dfdfdf;}
.mo_title{ clear:both; color:#000; padding:6px 8px 6px 12px; cursor:pointer; }
.btn_all_tiny_img{background-image:url( http://mimg.163.com/netfolder/images/all_toolbar_tiny.gif); background-repeat:no-repeat;}
.mo_title_l{ display:block; margin-right:12px; width:auto;}
.mo_title_r1,.mo_title_r2{ display:block; float:right; margin-left:-12px; height:12px; width:12px; background-position:0px 0px;}
.mo_title_r2{background-position:-16px 0px;}
.tbl_inner_title,.mo_title{ background-repeat:repeat-x; background-image:url( http://mimg.163.com/netfolder/images/rx_2.gif); background-position:0 bottom; background-color:#fafafa;}
.mo_con{ clear:both; padding:8px 12px;color:#CC3300;}
</style>
<script type="text/javascript" language="javascript">
var webPan={
first:function(x){return x.firstChild||x.firstChild.nextSibling},
next:function(x){
do{x=x.nextSibling}while(x&&x.nodeType!=1);
return x;
},
set:function(x,_1,_2,_3){
this.next(x).style.display = _1;
this.first(x).className = this.first(x).className.replace(_2,_3);
},
init:function(){
var _this=this,_0='mo_title_r1',_1='mo_title_r2';
function $(o){return document.getElementById(o)};
this.win=[];
for (var i=0;i<arguments.length;++i ) {
var _i=this.first($(arguments[i]));
this.set(_i,'none',_0,_1);
_i.onclick=function (){
if(_this.prev&&_this.prev!=this){_this.set(_this.prev,'none',_0,_1)};
var _2=_this.first(this).className.indexOf(_1) == 0?['',_1,_0]:['none',_0,_1];
_this.set(this,_2[0],_2[1],_2[2]);
_this.prev=this;
}
}
}
};
window.onload = function (){
webPan.init('win1','win2','win3','win4')
}
</script>
</head>
<body>
<div class="wp_sidebar">
<div class="mo_wp" id="win1" >
<div class="mo_title">
<div class="mo_title_r1 btn_all_tiny_img"></div>
<div class="mo_title_l">空间信息</div>
</div>
<div class="mo_con"><ul><li>1232321</li><li>1232321</li><li>1232321</li><li>1232321</li><li>1232321</li><li>1232321</li></ul>
这家伙很懒</div>
</div>
<div class="mo_wp" id="win2" >
<div class="mo_title">
<div class="mo_title_r1 btn_all_tiny_img"></div>
<div class="mo_title_l">个人信息</div>
</div>
<div class="mo_con">这家伙很懒,</div>
</div>
<div class="mo_wp" id="win3" >
<div class="mo_title">
<div class="mo_title_r1 btn_all_tiny_img"></div>
<div class="mo_title_l">系统</div>
</div>
<div class="mo_con">12:00 停机</div>
</div>
<div class="mo_wp" id="win4" >
<div class="mo_title">
<div class="mo_title_r1 btn_all_tiny_img"></div>
<div class="mo_title_l">版权</div>
</div>
<div class="mo_con">WebPan 1.0</div>
</div>
</div>
</div>
</body>
有没有具体的改法啊 ,我知道可能是因为document.getElementById 的原因,但还是知道怎样改才兼容火狐 展开
html,body{height:100%; text-align:center; font-size:12px; color:#404040}
.wp_sidebar{background:fff;width:230px; margin:30px auto; text-align:left;}
.mo_wp{ background:#F7F7F7; margin-bottom:4px;border:1px solid #dfdfdf;}
.mo_title{ clear:both; color:#000; padding:6px 8px 6px 12px; cursor:pointer; }
.btn_all_tiny_img{background-image:url( http://mimg.163.com/netfolder/images/all_toolbar_tiny.gif); background-repeat:no-repeat;}
.mo_title_l{ display:block; margin-right:12px; width:auto;}
.mo_title_r1,.mo_title_r2{ display:block; float:right; margin-left:-12px; height:12px; width:12px; background-position:0px 0px;}
.mo_title_r2{background-position:-16px 0px;}
.tbl_inner_title,.mo_title{ background-repeat:repeat-x; background-image:url( http://mimg.163.com/netfolder/images/rx_2.gif); background-position:0 bottom; background-color:#fafafa;}
.mo_con{ clear:both; padding:8px 12px;color:#CC3300;}
</style>
<script type="text/javascript" language="javascript">
var webPan={
first:function(x){return x.firstChild||x.firstChild.nextSibling},
next:function(x){
do{x=x.nextSibling}while(x&&x.nodeType!=1);
return x;
},
set:function(x,_1,_2,_3){
this.next(x).style.display = _1;
this.first(x).className = this.first(x).className.replace(_2,_3);
},
init:function(){
var _this=this,_0='mo_title_r1',_1='mo_title_r2';
function $(o){return document.getElementById(o)};
this.win=[];
for (var i=0;i<arguments.length;++i ) {
var _i=this.first($(arguments[i]));
this.set(_i,'none',_0,_1);
_i.onclick=function (){
if(_this.prev&&_this.prev!=this){_this.set(_this.prev,'none',_0,_1)};
var _2=_this.first(this).className.indexOf(_1) == 0?['',_1,_0]:['none',_0,_1];
_this.set(this,_2[0],_2[1],_2[2]);
_this.prev=this;
}
}
}
};
window.onload = function (){
webPan.init('win1','win2','win3','win4')
}
</script>
</head>
<body>
<div class="wp_sidebar">
<div class="mo_wp" id="win1" >
<div class="mo_title">
<div class="mo_title_r1 btn_all_tiny_img"></div>
<div class="mo_title_l">空间信息</div>
</div>
<div class="mo_con"><ul><li>1232321</li><li>1232321</li><li>1232321</li><li>1232321</li><li>1232321</li><li>1232321</li></ul>
这家伙很懒</div>
</div>
<div class="mo_wp" id="win2" >
<div class="mo_title">
<div class="mo_title_r1 btn_all_tiny_img"></div>
<div class="mo_title_l">个人信息</div>
</div>
<div class="mo_con">这家伙很懒,</div>
</div>
<div class="mo_wp" id="win3" >
<div class="mo_title">
<div class="mo_title_r1 btn_all_tiny_img"></div>
<div class="mo_title_l">系统</div>
</div>
<div class="mo_con">12:00 停机</div>
</div>
<div class="mo_wp" id="win4" >
<div class="mo_title">
<div class="mo_title_r1 btn_all_tiny_img"></div>
<div class="mo_title_l">版权</div>
</div>
<div class="mo_con">WebPan 1.0</div>
</div>
</div>
</div>
</body>
有没有具体的改法啊 ,我知道可能是因为document.getElementById 的原因,但还是知道怎样改才兼容火狐 展开
4个回答
展开全部
<style>
html,body{height:100%; text-align:center; font-size:12px; color:#404040}
.wp_sidebar{background:fff;width:230px; margin:30px auto; text-align:left;}
.mo_wp{ background:#F7F7F7; margin-bottom:4px;border:1px solid #dfdfdf;}
.mo_title{ clear:both; color:#000; padding:6px 8px 6px 12px; cursor:pointer; }
.btn_all_tiny_img{background-image:url( http://mimg.163.com/netfolder/images/all_toolbar_tiny.gif); background-repeat:no-repeat;}
.mo_title_l{ display:block; margin-right:12px; width:auto;}
.mo_title_r1,.mo_title_r2{ display:block; float:right; margin-left:-12px; height:12px; width:12px; background-position:0px 0px;}
.mo_title_r2{background-position:-16px 0px;}
.tbl_inner_title,.mo_title{ background-repeat:repeat-x; background-image:url( http://mimg.163.com/netfolder/images/rx_2.gif); background-position:0 bottom; background-color:#fafafa;}
.mo_con{ clear:both; padding:8px 12px;color:#CC3300;}
</style>
<script type="text/javascript" language="javascript">
var webPan={
first:function(x)
{
x=x.firstChild;
while (x.nodeType!=1)
{
x=x.nextSibling;
}
return x;
},
next:function(x){
do{x=x.nextSibling}while(x&&x.nodeType!=1);
return x;
},
set:function(x,_1,_2,_3){
this.next(x).style.display = _1;
this.first(x).className = this.first(x).className.replace(_2,_3);
},
init:function(){
var _this=this,_0='mo_title_r1',_1='mo_title_r2';
function $(o){return document.getElementById(o)};
this.win=[];
for (var i=0;i<arguments.length;++i ) {
var _i=this.first($(arguments[i]));
this.set(_i,'none',_0,_1);
_i.onclick=function (){
if(_this.prev&&_this.prev!=this){_this.set(_this.prev,'none',_0,_1)};
var _2=_this.first(this).className.indexOf(_1) == 0?['',_1,_0]:['none',_0,_1];
_this.set(this,_2[0],_2[1],_2[2]);
_this.prev=this;
}
}
}
};
window.onload = function (){
webPan.init('win1','win2','win3','win4')
}
</script>
</head>
<body>
<div class="wp_sidebar">
<div class="mo_wp" id="win1" >
<div class="mo_title">
<div class="mo_title_r1 btn_all_tiny_img"></div>
<div class="mo_title_l">空间信息</div>
</div>
<div class="mo_con"><ul><li>1232321</li><li>1232321</li><li>1232321</li><li>1232321</li><li>1232321</li><li>1232321</li></ul>
这家伙很懒</div>
</div>
<div class="mo_wp" id="win2" >
<div class="mo_title">
<div class="mo_title_r1 btn_all_tiny_img"></div>
<div class="mo_title_l">个人信息</div>
</div>
<div class="mo_con">这家伙很懒,</div>
</div>
<div class="mo_wp" id="win3" >
<div class="mo_title">
<div class="mo_title_r1 btn_all_tiny_img"></div>
<div class="mo_title_l">系统</div>
</div>
<div class="mo_con">12:00 停机</div>
</div>
<div class="mo_wp" id="win4" >
<div class="mo_title">
<div class="mo_title_r1 btn_all_tiny_img"></div>
<div class="mo_title_l">版权</div>
</div>
<div class="mo_con">WebPan 1.0</div>
</div>
</div>
</div>
</body>
html,body{height:100%; text-align:center; font-size:12px; color:#404040}
.wp_sidebar{background:fff;width:230px; margin:30px auto; text-align:left;}
.mo_wp{ background:#F7F7F7; margin-bottom:4px;border:1px solid #dfdfdf;}
.mo_title{ clear:both; color:#000; padding:6px 8px 6px 12px; cursor:pointer; }
.btn_all_tiny_img{background-image:url( http://mimg.163.com/netfolder/images/all_toolbar_tiny.gif); background-repeat:no-repeat;}
.mo_title_l{ display:block; margin-right:12px; width:auto;}
.mo_title_r1,.mo_title_r2{ display:block; float:right; margin-left:-12px; height:12px; width:12px; background-position:0px 0px;}
.mo_title_r2{background-position:-16px 0px;}
.tbl_inner_title,.mo_title{ background-repeat:repeat-x; background-image:url( http://mimg.163.com/netfolder/images/rx_2.gif); background-position:0 bottom; background-color:#fafafa;}
.mo_con{ clear:both; padding:8px 12px;color:#CC3300;}
</style>
<script type="text/javascript" language="javascript">
var webPan={
first:function(x)
{
x=x.firstChild;
while (x.nodeType!=1)
{
x=x.nextSibling;
}
return x;
},
next:function(x){
do{x=x.nextSibling}while(x&&x.nodeType!=1);
return x;
},
set:function(x,_1,_2,_3){
this.next(x).style.display = _1;
this.first(x).className = this.first(x).className.replace(_2,_3);
},
init:function(){
var _this=this,_0='mo_title_r1',_1='mo_title_r2';
function $(o){return document.getElementById(o)};
this.win=[];
for (var i=0;i<arguments.length;++i ) {
var _i=this.first($(arguments[i]));
this.set(_i,'none',_0,_1);
_i.onclick=function (){
if(_this.prev&&_this.prev!=this){_this.set(_this.prev,'none',_0,_1)};
var _2=_this.first(this).className.indexOf(_1) == 0?['',_1,_0]:['none',_0,_1];
_this.set(this,_2[0],_2[1],_2[2]);
_this.prev=this;
}
}
}
};
window.onload = function (){
webPan.init('win1','win2','win3','win4')
}
</script>
</head>
<body>
<div class="wp_sidebar">
<div class="mo_wp" id="win1" >
<div class="mo_title">
<div class="mo_title_r1 btn_all_tiny_img"></div>
<div class="mo_title_l">空间信息</div>
</div>
<div class="mo_con"><ul><li>1232321</li><li>1232321</li><li>1232321</li><li>1232321</li><li>1232321</li><li>1232321</li></ul>
这家伙很懒</div>
</div>
<div class="mo_wp" id="win2" >
<div class="mo_title">
<div class="mo_title_r1 btn_all_tiny_img"></div>
<div class="mo_title_l">个人信息</div>
</div>
<div class="mo_con">这家伙很懒,</div>
</div>
<div class="mo_wp" id="win3" >
<div class="mo_title">
<div class="mo_title_r1 btn_all_tiny_img"></div>
<div class="mo_title_l">系统</div>
</div>
<div class="mo_con">12:00 停机</div>
</div>
<div class="mo_wp" id="win4" >
<div class="mo_title">
<div class="mo_title_r1 btn_all_tiny_img"></div>
<div class="mo_title_l">版权</div>
</div>
<div class="mo_con">WebPan 1.0</div>
</div>
</div>
</div>
</body>
展开全部
您好!很高兴为您答疑!
火狐下您可以安装Firebug,它集HTML查看和编辑、Javascript控制台、网络状况监视器于一体,是开发JavaScript、CSS、HTML和Ajax的得力助手。
您可以在火狐社区了解更多内容。希望我的回答对您有所帮助,如有疑问,欢迎继续在本平台咨询。
火狐下您可以安装Firebug,它集HTML查看和编辑、Javascript控制台、网络状况监视器于一体,是开发JavaScript、CSS、HTML和Ajax的得力助手。
您可以在火狐社区了解更多内容。希望我的回答对您有所帮助,如有疑问,欢迎继续在本平台咨询。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
这个是js的浏览器兼容问题,看你的代码看得有点晕,你看看这里吧,上面有你需要的:http://www.360doc.com/content/10/0705/10/11991_36995556.shtml
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
document.getElementById IE和火狐用的方式是不一样的 样式,方法等问题,兼容等问题
类似这些问题有很多,具体研究可以参考楼上的连接
类似这些问题有很多,具体研究可以参考楼上的连接
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询