Child Window and Parent Window

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
Vishal1R
Forum Newbie
Posts: 3
Joined: Sun Feb 09, 2014 6:42 am

Child Window and Parent Window

Post 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>
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Child Window and Parent Window

Post by requinix »

Code: Select all

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