功能介绍:a.aspx 点击“添加”,弹出b.aspx模式对话框,在b页面里的TextBox1填写玩内容后,点击确定,b页面关闭,a页面的TextBox1显示b页面刚填写的内容.
A页面代码:
<html >
<head runat="server">
<title></title>
<script language="javas
function opendialog()
{
var someValue=window.showModalDialog ("b.aspx","","dialogWidth=300px;dialogHeight=250px;status=no;help=no;scrollbars=no")
document.form1.TextBox1.value=someValue;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<input id="Button1" type="button" value="button" on
</form>
</body>
</html>
B页面代码:
<html>
<head runat="server">
<title></title>
<script language="javas
function a()
{
//读取TexBox1的内容,返回给调用页面
parent.window.returnValue = document.getElementById("TextBox1").value;
window.close();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<input id="Button1" type="button" value="button" on
</form>
</body>
</html>
注意:因为只调用客户端脚本,所以这里的button用的都是Html的button而不是ASP.NET的Button,这样不用刷新页面,效率更高,若用Asp.net的Button,则是用On