我想在IE中通过鼠标操作显示层,可这段简单的代码却提示两处错误,请高手指点。(50分)

  • 主题发起人 foreveryouth
  • 开始时间
F

foreveryouth

Unregistered / Unconfirmed
GUEST, unregistred user!
<HTML>
<HEAD>
<script language="JavaScript">
showlayer(){
if(document.all) document.all.layer1.style.visibility="visible";
}
</script>
</HEAD>
<BODY>
<a href="#" onmouseover="showlayer()">asas</a>
<input type="button" value="Button" name="B1" onclick="showlayer()">
<div id="layer1" style="position:absolute;visibility:hidden;clip:rect(0 150 50 0);width:150px;background-color:lightyellow"></div>
</BODY>
</HTML>
当鼠标移到asas上和点击button时,提示缺少对象。哪儿出错,请指点。谢谢!
 
javascript函数showlayer定义的时候没有用function关键字框起来
 
接受答案了.
 
顶部