oElement.style.VISIBILITY = 'show'
改为
oElement.style.VISIBILITY = 'visible'
改为
oElement.style.VISIBILITY = 'visible'
解决方案 »
- Google登录,急急急!!!
- getElementByName()问题
- switch无效,总是执行 default:
- 求一个选择城市可以获得该城市区号的JS,网上找了半天了,一无所获:(
- this.setColor = new Function('arg', 'this.color = arg.toLowerCase();');是什么意思???
- js 中语法问题
- 获得父窗体Cookie的问题,有点难度吧....Help me!!!
- 请问,用window.open打开窗口时,怎么使新窗口位于屏幕中央?等待中......
- 关于iframe间打开页面
- audio自动播放
- 有什么办法实现XP风格的下拉框?
- 如何用javascript终止提交的过程
oElement.style.VISIBILITY = 'visible'了后
还是显示不出来啊
oElement.style.display=''
function showLayer(LayerName)
{
var oElement = document.getElementById(LayerName);
if(oElement != null)
oElement.style.visibility = 'visible';
}
function showLayer(LayerName)
{
var oElement = document.getElementById(LayerName);
if(oElement != null)
oElement.style.visibility = 'visible';
}
这样下来总是oElement总是null
我
if(oElement != null)
{
oElement.style.visibility = 'visible';
alert("1");
}
根本就不会执行到 alert("1");啊,这是怎么回事啊
Layer1.style.visibility = 'visible';
居然说是
错误:'Layer1.style'为空或不是对象
这是怎么回事啊???
function showLayer(LayerName)
{
var oElement = document.getElementById(LayerName);
if(oElement != null)
oElement.style.visibility = 'visible';
}
这样写又行了。
可是Layer1还是没有出现在页面上
我试了一下可以啊
你是不是在这个页面上定义了好几个Layer1啊,
呵呵
function showLayer(LayerID)
{
if( document.getElementById(LayerID)=="[object]")
{
var oElement = document.getElementById(LayerID);
oElement.style.visibility="visible";
}
}
</SCRIPT>
function showLayer(LayerName)
{
LayerName.style.display = '';}
function hide(LayerName)
{
LayerName.style.display = 'none';}
</script>
<a href="frame01.htm" target="mainFrame"><img border="0"
onMouseover="showLayer(Layer1);this.src='images/caidan01b.gif'"
src="images/caidan01a.gif" onmouseout="hide(Layer1)"></a> <DIV id=Layer1
style="Z-INDEX: 1; LEFT: 200px; display: none; WIDTH: 100px; POSITION: absolute; TOP: 110px; HEIGHT: 22px">
<TABLE borderColor=#ffff00 cellSpacing=0 cellPadding=0 width=100%
border=1>
<tr>
<TD align=middle bgColor=#ffff00><A
href="tree.aspx"
target=_blank>tree</A></TD>
<td>b</td>
<td>c</td>
<td>d</td>
<td>e</td>
</tr>
</TABLE></DIV>
<img border="0" onMouseMove="showLayer(Layer1);this.src='images/caidan01b.gif'"
src="images/caidan01a.gif">
showLayer(Layer1)
你在这里调用的时候传入的是一个对象的id引用
function showLayer(LayerName)
{
while( document.getElementById(LayerName) != null)
{
var oElement = document.getElementById(LayerName);
oElement.style.VISIBILITY = 'show';
}
}
但你的函数写的时候又将传入的参数当作字符串对待,当然出错:)
修改的方法要么就是按我上边那么改写函数
要么就修改调用方法:
showLayer("Layer1"),然后按照前边朋友的指点修改你的函数。