<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>父模塊</title>
<script type="text/javascript" language="javascript">
function EditIDandName() {
var str = window.showModalDialog(
"ShowModal.aspx?ID=" + document.getElementById("<%=txtID.ClientID %>").value, "window", "scroll:no;status:no;help:no;dialogWidth:600px;dialogHeight:400px");
if (str != null) {
var value = str.split(',');
document.getElementById("<%=txtID.ClientID %>").readOnly = false;
document.getElementById("<%=txtID.ClientID %>").value = value[0];
document.getElementById("<%=txtName.ClientID %>").readOnly = false;
document.getElementById("<%=txtName.ClientID %>").value = value[1];
}
return false;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:Label ID="lblID" Text="編碼" runat="server"></asp:Label>
<asp:TextBox ID="txtID" Text="" runat="server"></asp:TextBox>
<asp:Label ID="lblName" Text="名稱" runat="server"></asp:Label>
<asp:TextBox ID="txtName" Text="" runat="server"></asp:TextBox>
<asp:Button ID="btnShowModalDialog" runat="server" Text="ModalDialog" OnClientClick="return EditIDandName();" />
</form>
</body>
</html>
<head runat="server">
<base target="_self" />
<title>子模塊</title>
<script type="text/javascript" language="javascript">
function setModal(thisObj,thisEvent) {
var thisId = thisObj.id;
var id = document.getElementById("txtID").value;
var name = document.getElementById("txtName").value;
var retStr = id + "," + name;
window.returnValue = retStr;
self.close();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:Label ID="lblID" Text="編碼" runat="server"></asp:Label>
<asp:TextBox ID="txtID" Text="" runat="server"></asp:TextBox>
<asp:Label ID="lblName" Text="名稱" runat="server"></asp:Label>
<asp:TextBox ID="txtName" Text="" runat="server"></asp:TextBox>
<asp:Button ID="btnSetModal" runat="server" Text="SetModalDialog" OnClientClick="return setModal(this,event);"/>
</form>
</body>
</html>