div显示问题,解答立即给分!!!1
//显示隐藏层的javascript函数
function showhideLayer(layer,hide)
{
obj = document.getElementById(layer);
if(hide== "hide ")
{
obj.style.display = "none ";
}
else
{
obj.style.display = " ";
document.getElementById( "delreason ").selectedIndex=0;
}
<div id= "Layer1 " style= "position:absolute; left:128px; top:125px; width:500px; height:104px; z-index:1; display: none; "> </div>
在asp中调用就是不能正常显示层,而如果在else
{
obj.style.display = " ";
document.getElementById( "delreason ").selectedIndex=0;
}里加个alert( "sfsfs ");就能把层显示出来,
大家帮我看看究竟是怎么回事!!!!!
------解决方案--------------------obj.style.display = " ";
-->
obj.style.display = "block ";
------解决方案--------------------function showhideLayer(layer,hide)
{
obj = document.getElementById(layer);
if(hide== "hide ")
{
obj.style.display = "none ";
}
else
{
obj.style.display = "block ";
document.getElementById( "delreason ").selectedIndex=0;
}
}
------解决方案--------------------把运行后的HTML贴出来看啊
------解决方案--------------------这个可以用
我现在在也做的就和这个差不多
不过只用一个input
------解决方案-------------------- <body bgcolor=black leftmargin= "0 " topmargin= "0 " onLoad= "showhideLayer( 'Layer1 ', ' '); ">
把这句改一下.楼主是不是想实现这样的效果啊
------解决方案--------------------试一下同时设置style.display和style.visibility
显示
obj.style.display= "block ";
obj.style.visibility= "visible ";
隐藏
obj.style.display= "none ";
obj.style.visibility= "hidden ";
------解决方案--------------------function showhideLayer(layer)
{
obj = document.getElementById(layer);
if(obj.style.display == "block ")
{
obj.style.display = "none ";
}
else
{
obj.style.display = "block ";
document.getElementById( "delreason ").selectedIndex=0;
}
}
------解决方案--------------------Try :
-------------------
function showhideLayer(layer)
{
obj = document.getElementById(layer);
if(obj.style.display == " ")
{
obj.style.display = "none ";
}
else
{
obj.style.display = " ";
document.getElementById( "delreason ").selectedIndex=0;