Page 1 of 1

Child Window and Parent Window

Posted: Sun Feb 09, 2014 6:48 am
by Vishal1R
Hi

I want to get hyperlink Name from child window to be displayed on textbox in parent window. Plz help me.

Here are my two files:

This is trial1.php file:

Code: Select all

<?php

?>
<html>
<body>

<script>
function my(){
var myW = window.open("trial2.php","","width=200,height=200");
}
</script>
<form id="MyF" name="M1">
<input type="text" name="txt1" id="t1">
<input type="button" name="btn" onclick="my();" value="Click">
</form>
</body>
</html>

This is trial2.php file:

<?php

?>
<html>
<body>
<script>
function tam(){
window.opener.document.M1.txt1.value=document.getElementById('tk').value;
window.close();  
}
</script>
<form id="tk">
<p><a href="" onclick="tam();">Love</a></p>
</form>
</body>
</html>

Re: Child Window and Parent Window

Posted: Mon Feb 10, 2014 4:39 pm
by requinix

Code: Select all

document.getElementById('tk').value;
tk is a form and forms don't have .values.