页面间相互控制
Default21.aspx:
<html xmlns= "http://www.w3.org/1999/xhtml " >
<head runat= "server ">
<title> Untitled Page </title>
<script language= "javascript " type= "text/javascript ">
function openwin()
{
window.open( "Default22.aspx ");
}
</script>
</head>
<body>
<form id= "form1 " runat= "server ">
<div>
<input id= "openButton " type= "button " onclick= "openwin() " />
</div>
</form>
</body>
</html>
在Default21.aspx中,打开Default22.aspx页面。
Default22.aspx:
<html xmlns= "http://www.w3.org/1999/xhtml " >
<head runat= "server ">
<title> Untitled Page </title>
</head>
<body>
<form id= "form1 " runat= "server ">
<div>
<asp:Button runat= "server " ID= "aaa " />
</div>
</form>
</body>
</html>
Default22.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
//Response.Write( " <script> parent.form1.myButton.disabled=true; </script> ");
if(!IsPostBack)
aaa.Attributes.Add( "onclick ", " <script> window.parent.myButton.disabled=true;return false </script> ");
}
为什么Default22.aspx.cs的代码不能控制Default21里的控件状态。有什么可以解决的方法吗?
------解决方案-------------------- <script> window.opener.openButton.disabled=true;return false </script> ");
------解决方案--------------------window.opener.document.all.Button1.disabled=true;return false