通过它的display属性来控制<div id="div1" style="display:none">Hello</div><input type=button id=btn value="显示" onclick="showit()">
<script>
function showit()
{
document.all("div1").style.display = "block";
}如果用panel控件,在服务端控制,比这更简单
<asp:panel id="panel1" runat=server Visible=false>hello</asp:panel>
<asp:Button id="btn1" text="show" runat="server" />在点btn1的服务端事件中写
panel1.Visible = true;

解决方案 »

  1.   

    我的意思没表达清楚
    我的页面上有一些
    textBox和label控件
    在刚开始的时候他们是不显示的
    但用户点击一个名为show的checkbox以后
    他们才显示出来
    这样怎么做呢?
      

  2.   

    page_load事件里写
    if (!IsPostBack)
    {
      xx.visible = false;
    }button事件里写
    xx.visible = true;
      

  3.   

    cnhgj(戏子) will cause additional traffic to the server.My method is as following,
    User javascript to swat between style='DISPLAY: none' and style='DISPLAY:'<DIV id="view" style="DISPLAY: none">
    ................
    Put whatever you like here, textbox, lable, dropdown list, etc
    ................
    </DIV>
      

  4.   

    刚刚试了一下,在button的Click事件中改变空间的visible属性
    是可以的做到空间的显示的
    但是在CheckedChanged事件中改属性,页面上的控件还是看不到
    好像是页面没有刷新一样
      

  5.   

    发现问题,要把checkbox的AutoPostBack属性设置为true
      

  6.   

    如果要点击checkbox也显示的话,那么autopostback = true;然后里面也加入xx.visible = true