父窗体
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server"><title></title>
<script src="jquery/jquery-1.7.2.js" type="text/javascript"></script>
<script type="text/javascript">
function show() {
var ret = window.showModalDialog("WebForm2.aspx", null, "dialogWidth:500px;dialogHeight:500px;status:no");
if (ret) {
$('#text').val(ret);
}
else {
alert("假");
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input type="button" id="inputbtn" value="注册" οnclick="show()" />
<input type="text" id="text" />
</div>
</form>
</body>
</html>
子窗体
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="jsJavaScript.WebForm2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript">
function tangs(tag) {
if (tag == 0) {
window.returnValue = false;
}
else {
window.returnValue = true;
}
window.close();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input type="button" id="button1" value="返回真" οnclick="tangs(1)" />
<input type="button" id="button2" value="返回假" οnclick="tangs(0)" />
</div>
</form>
</body>
</html>