Powered By Blogger

Wednesday, December 30, 2009

getting values from popup window using javascript


Getting values from popup window using javascript

parent page:

popupform.htm:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Opener</title>
<script type='text/javascript'>
function valideopenerform(){
var popy= window.open('popup.htm','popup_form','menubar=no,status=no,top=25%,left=25;')
alert (popy.window.document.URL);
}
</script>
</head>

<body>
<form name='openerform' id='openerform' >
<input type='text' id='text1' name='text1' />
<input type='button' value='go' onclick='valideopenerform()' />
</form>

</body>

</html>

which page to be pop up:

popup.htm


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Opener</title>
<script type='text/javascript'>
function validepopupform(){
window.opener.document.openerform.text1.value=document.popupform.text2.value;
self.close();
}
</script>

</head>

<body>
<form id='popupform' name='popupform' >
<input type='text' id='text2' name='text2' />
<input type='button' value='go' onclick='validepopupform()' />
</form>

</body>

</html>


No comments:

Post a Comment