当前位置: 代码迷 >> ASP.NET >> js掩藏div
  详细解决方案

js掩藏div

热度:1531   发布时间:2013-02-25 00:00:00.0
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>
  相关解决方案