팝업창에서 부모창으로 값보내기
Asp.NET 2009. 4. 30. 12:07 |<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript">
function child() {
window.open("Default2.aspx");
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input id="Text1" type="text" />
<div>
<input id="Button1" type="button" value="button" onclick="child()" />
</div>
</div>
</form>
</body>
</html>
그리고 자식창 소스... Default2.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript">
function test() {
var ctbox = document.getElementById("Text1");
var ptbox = parent.opener.document.getElementById("Text1");
ptbox.value = ctbox.value;
window.close();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input id="Text1" type="text" />
</div>
<div>
<input id="Button1" type="button"
value="button" onclick="test()" />
</div>
</form>
</body>
</html>