- javascript控制页面控件隐藏显示的两种方法,方法的不同之处在于控件隐藏后是否还在页面上占位
方法一:
document.all["PanelSMS"].style.visibility="hidden";
document.all["PanelSMS"].style.visibility="visible";
方法二:
document.all["PanelSMS"].style.display="none";
document.all["PanelSMS"].style.display="inline";
方法一隐藏后 页面的位置还被控件占用 只是不显示 类似于.net验证控件的Display=Static
方法二隐藏后 页面的位置不被占用 类似于.net验证控件的Display=Dynamic
- 改变控件状态或值
Response.Write("<script>parent.frames['contents'].document.all('Panel3').style.display='inline';</script>");
- 子页面向父页面传值
Response.Write("<script>opener.parent.frames['main'].document.all.TxtUserName.value='"+NameList+"';window.opener=null;window.close();</script>");
- 服务器控件加属性后会闪动
<form id="Form1" method="post" runat="server">
<INPUT id="eeeee" type="text">
<asp:Button id="Button1" runat="server"
Text="Button" CausesValidation="False" EnableViewState="False"></asp:Button></form>
这一句,
Button1.Attributes.Add("onClick","document.Form1.eeeee.value=parent.frames['WebForm2'].document.Form1.TextBox1.value;");修改一下:
Button1.Attributes.Add("onClick","document.Form1.eeeee.value=parent.frames['WebForm2'].document.Form1.TextBox1.value;return(false);");
这样就不会了.
原因是,ASP.NET里面的服务器按钮控件,都相当于原ASP页面里面的submit按钮,点击它总是提交页面,加了个return(false),意思等于在问题:我点击了按钮,你同意吗?然后回答就是同意/不同意,同意则提交,不同意则不动.
posted on
2005-06-28 14:57
BOBO
阅读(
382)
评论()
收藏
举报