首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

js掩藏div

2011-12-21 
js隐藏divscriptfunctionclose(){if(event.srcElement!document.getElementById( div1 )){document.f

js隐藏div
<script>
 
    function   close()
  {
        if(event.srcElement   !=     document.getElementById( "div1 "))
        {
                document.form1.getElementById( "div1 ").style.display   = "none "
        }
  }
 
</script>

    <form   id= "form1 "   runat= "server ">
        <div   id= "div1 ">
                          <asp:ImageButton   ID= "ImageButton1 "   runat= "server "   Height= "13px "   ImageUrl= "~/images/close.gif "   OnClientClick= "close() "
        </div>
        </form>

哪里不对啊

[解决办法]
<script>

function hide()
{
document.getElementById( "div1 ").style.display = "none ";
}

</script>

<form id= "form1 " runat= "server ">
<div id= "div1 ">
<asp:ImageButton ID= "ImageButton1 " runat= "server " Height= "13px " ImageUrl= "~/images/close.gif " OnClientClick= "hide() " />
</div>
</form>

热点排行