function show(val)
{
if(document.getElementById(val).style.display == 'none')
document.getElementById(val).style.display ='block';
else
document.getElementById(val).style.display = 'none';
}
请各位大虾帮帮忙啊~~
我在IE8下面测试是OK的,但是在火狐下没效果,在网上找了很多地方,
都说把display=‘block’改为display=''就ok,可是我试了不行,请问还有其他办法吗??
{
if(document.getElementById(val).style.display == 'none')
document.getElementById(val).style.display ='block';
else
document.getElementById(val).style.display = 'none';
}
请各位大虾帮帮忙啊~~
我在IE8下面测试是OK的,但是在火狐下没效果,在网上找了很多地方,
都说把display=‘block’改为display=''就ok,可是我试了不行,请问还有其他办法吗??
$("#content1").css("display" , "");
<head>
<title>层</title>
<script type="text/javascript">
function show(val)
{
if (document.getElementById(val).style.display == 'none')
{ document.getElementById(val).style.display = 'block';
}
else
{ document.getElementById(val).style.display = 'none';
}
}
</script>
</head>
<body>
<input type='text' id='tx1' style="display:none">
</body>
<input type="button" onclick="show('tx1')" value="点我">
</html>火狐下 没问题
<div class="bottom_myor" id="myor" style="display:none">
<ul>
<li>
<a href="{Context:BuildUrl('gourmet','reviews')}?userid={CurrentUser/User/UserId}">我的食评</a>
</li>
<li>
<a href="{Context:BuildUrl('gourmet','briefreviews')}?userid={CurrentUser/User/UserId}">我的短评</a>
</li>
<li>
<a href="{Context:BuildUrl('gourmet','photos')}?userid={CurrentUser/User/UserId}">我的相片</a>
</li>
<li>
<a href="{Context:BuildUrl('gourmet','bookrestaurant')}?userid={CurrentUser/User/UserId}">开饭行踪</a>
</li>
<li>
<a href="{Context:BuildUrl('gourmet','bbs')}?userid={CurrentUser/User/UserId}">我的留言</a>
</li>
</ul>
</div>
<script type="text/javascript">
function show(val)
{
if(document.getElementById(val).style.display == 'none')
document.getElementById(val).style.display ='block';
else
document.getElementById(val).style.display = 'none';
}
</script>
</head><body>
<p id='val' onclick="show(this.id)">If you click on me, I will disappear.</p>
<input onclick="show('val')" type='button' value='show the p' />
</body></html>
我的FF3.6.18 没有问题
<p style='display:block'></p>
{
var p = document.getElementById("test");
p.style.display = p.style.display === "block" ? "none" : "block";
} </script> <p id="test" style="display:none">p</p>
<input type="button" value="test" onclick="toggle()" />
修改后的code:window.onload= function show()
{
var Avl = document.getElementById("myor");
Avl.style.display = "none";
document.getElementById("bottom").onclick = function(){
Avl.style.display = Avl.style.display == "block" ? "none" : "block";}
}
PS:还是谢谢各位啊~~问题出在对css了解不透彻,还有不懂IE和火狐之间性能的不同~~