弹出窗口 在子窗口中返回值给父窗口
parent:
sub:
<script>
function openDialog2(srcW,srcH,srcU,sl)
{
var X=0;
var Y=0;
var Cstyle;
X=(screen.width-srcW)/2;
Y=(screen.height-srcH)/2;
Cstyle = "dialogLeft:"+X+"px;dialogTop:"+Y+"px;dialogHeight:"+srcH+"px;dialogWidth:"+srcW+"px;help:no;status:no;scroll:"+sl;
var sReturnVal = window.showModalDialog(srcU,window,Cstyle);
return sReturnVal;
}
function GetValue()
{
var result=openDialog2('460','370','Pop.aspx','no');
var ddd=result.split(";");
document.getElementById("txtLocation").value=ddd[1];
document.getElementById("txtLocationId").value=ddd[0];
document.getElementById("txtManager").value=ddd[2];
}
</script>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<asp:textbox id="txtLocation" runat="server" Width="200px" ReadOnly="True"></asp:textbox>
<asp:textbox id="txtLocationId" runat="server" Width="200px" ReadOnly="True"></asp:textbox>
<asp:textbox id="txtManager" runat="server" Width="200px" ReadOnly="True"></asp:textbox>
<input value="点击选择" onclick="GetValue();" type="button">
</form>
</body>
function openDialog2(srcW,srcH,srcU,sl)
{
var X=0;
var Y=0;
var Cstyle;
X=(screen.width-srcW)/2;
Y=(screen.height-srcH)/2;
Cstyle = "dialogLeft:"+X+"px;dialogTop:"+Y+"px;dialogHeight:"+srcH+"px;dialogWidth:"+srcW+"px;help:no;status:no;scroll:"+sl;
var sReturnVal = window.showModalDialog(srcU,window,Cstyle);
return sReturnVal;
}
function GetValue()
{
var result=openDialog2('460','370','Pop.aspx','no');
var ddd=result.split(";");
document.getElementById("txtLocation").value=ddd[1];
document.getElementById("txtLocationId").value=ddd[0];
document.getElementById("txtManager").value=ddd[2];
}
</script>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<asp:textbox id="txtLocation" runat="server" Width="200px" ReadOnly="True"></asp:textbox>
<asp:textbox id="txtLocationId" runat="server" Width="200px" ReadOnly="True"></asp:textbox>
<asp:textbox id="txtManager" runat="server" Width="200px" ReadOnly="True"></asp:textbox>
<input value="点击选择" onclick="GetValue();" type="button">
</form>
</body>
sub:
<script>
function AddValue()
{
locationID = document.getElementById("txtID").value;
locationName = document.getElementById("txtLocation").value;
manager = document.getElementById("txtManager").value;
window.returnValue = locationID + ";" + locationName + ";" + manager;
window.close() ;
}
</script>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<FONT face="宋体">ID:</FONT>
<asp:TextBox id="txtID" runat="server"></asp:TextBox><BR>
<FONT face="宋体">LOCATION:</FONT>
<asp:TextBox id="txtLocation" runat="server"></asp:TextBox><BR>
<FONT face="宋体">MANAGER:</FONT>
<asp:TextBox id="txtManager" runat="server"></asp:TextBox><BR>
<input id="LocationAndManager" type="hidden" runat="server">
<br>
<input type="button" value="确定" onclick="AddValue();">
</form>
</body>
function AddValue()
{
locationID = document.getElementById("txtID").value;
locationName = document.getElementById("txtLocation").value;
manager = document.getElementById("txtManager").value;
window.returnValue = locationID + ";" + locationName + ";" + manager;
window.close() ;
}
</script>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<FONT face="宋体">ID:</FONT>
<asp:TextBox id="txtID" runat="server"></asp:TextBox><BR>
<FONT face="宋体">LOCATION:</FONT>
<asp:TextBox id="txtLocation" runat="server"></asp:TextBox><BR>
<FONT face="宋体">MANAGER:</FONT>
<asp:TextBox id="txtManager" runat="server"></asp:TextBox><BR>
<input id="LocationAndManager" type="hidden" runat="server">
<br>
<input type="button" value="确定" onclick="AddValue();">
</form>
</body>