请问一下,在.NET中如何用按钮来控制<SPAN>标签隐藏和显示?
在单击按钮时,<SPAN>标签中内容要全部显示出来或隐藏!!!

解决方案 »

  1.   

    <SPAN>把它弄成服务器控件
      

  2.   

    <span id="spSexAge" runat="server"></span>
    然后进行隐藏显示。显示内容的话用
     this.spDegree.InnerHtml = dt.Rows[0]["shenfen"].ToString();
      

  3.   

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>无标题页</title>
            <script language="javascript" type="text/javascript">
    function Button1_onclick() 
    {
        if(document.getElementById("span1").style.display == "none")
        {
            document.getElementById("span1").style.display = "inline";
        }
        else
        {
            document.getElementById("span1").style.display = "none";
        }
    }    </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <input id="Button1" type="button" value="button" onclick="return Button1_onclick()" />
            <span id="span1">xxx</span>
        </div>
        </form>
    </body>
    </html>