今天修改项目的时候想通过js来控制一个textbox的显示 ,开始的做法是将textbox.visible = false , 但是
document.all("textbox")这段js总是显示对象为空的错误,查看网页源代码发现找不到id为textbox的文本框,
难道是visible 属性的原因吗?我把默认隐藏的方法由visible = false 改为前台
document.all("txt_Reply").style.visibility = "hidden";之后就好了.
我查了一下msdn上对两者的解释是:
visible = true so ASP.NET will generate the html code about the control, if false, no html code about this control will be generated
style("visibility")="visible" so the browser will make the control visible on the client side, if "hidden", the control will not be visible on the client side, but the html code is still there