Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
how to populate parent window from child window
Old 01-29-2007, 12:02 AM how to populate parent window from child window
Junior Talker

Posts: 3
Trades: 0
hey guyz.....how do i populate parent window from child window ........

lets say.....my parent window is

Quote:
Quote:
<div align="left"><strong>search or <a href="javascriptpenpopup('example.html')">finite </a> </strong><form>
<strong>From:</strong>
<input type="text" id="textField">
</form>
<div id="contentArea"></div></div>
and my child window has a href link it....so what should i do to populate teh parent window when i click the href link in child window......i would appreciate any kinda help or suggestions guyz....thanx....
daraptor is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-29-2007, 12:43 AM Re: how to populate parent window from child window
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,935
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Trades: 0
Code:
function populateParentWindow() {
     window.parent.getElementById(div in parent window with unique id that will contain populated text from child window).innerHTML = "<p>Some stuff.</p>";
     return false; // you'll need this to ensure that you don't actually have a clickthrough to your child window link.
}
.......
.......
.......
<a href="#" onclick="populateParentWindow();">Your Link.</a>
Untested code, but it should work with some fairly obvious tweaking.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
(my blog)


Please login or register to view this content. Registration is FREE
(with proof)

Last edited by ADAM Web Design; 01-29-2007 at 12:45 AM.. Reason: Damned premature submission.
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Old 01-29-2007, 09:05 AM Re: how to populate parent window from child window
Kirtan's Avatar
Who Am I?

Posts: 376
Name: Venkat Raj
Location: Salem, South India
Trades: 3
You can use window.opener property instead
Code:
<html>
<body>

<script type="text/javascript">
myWindow=window.open('','MyName','width=200,height=100')
myWindow.document.write("This is 'myWindow'")
myWindow.focus()
myWindow.opener.document.write("This is the parent window")
</script>
</body>
</html>
__________________
All the Buddhas of all the ages have been telling you a very simple fact: Be -- don't try to become.
Kirtan is offline
Reply With Quote
View Public Profile Visit Kirtan's homepage!
 
Old 01-29-2007, 10:40 AM Re: how to populate parent window from child window
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,935
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Trades: 0
You could do that too, yeah. I prefer parent since it's the parent window, but yeah, you could do that.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
(my blog)


Please login or register to view this content. Registration is FREE
(with proof)
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Old 01-29-2007, 01:06 PM Re: how to populate parent window from child window
Junior Talker

Posts: 3
Trades: 0
Quote:
Originally Posted by ADAM Web Design View Post
Code:
function populateParentWindow() {
     window.parent.getElementById(div in parent window with unique id that will contain populated text from child window).innerHTML = "<p>Some stuff.</p>";
     return false; // you'll need this to ensure that you don't actually have a clickthrough to your child window link.
}
.......
.......
.......
<a href="#" onclick="populateParentWindow();">Your Link.</a>
Untested code, but it should work with some fairly obvious tweaking.
hey man...thanx for the reply and help appreciate it...but i have one more doubt...
am addin this script in my parent window right....and the href link in the child window....right...then should i replace " div in prent window with unique id ..... <p> some stuff</p> " with something.....i mean the whole text jss sits in there or do i have to add something.....thanx
daraptor is offline
Reply With Quote
View Public Profile
 
Old 01-31-2007, 07:30 AM Re: how to populate parent window from child window
Kirtan's Avatar
Who Am I?

Posts: 376
Name: Venkat Raj
Location: Salem, South India
Trades: 3
Quote:
Originally Posted by daraptor View Post
am addin this script in my parent window right....and the href link in the child window....right...
No. You have to add that script in child window. and when you click the link, href call populate function. There you get the id of to be populate element which is in parent window. that is the meaning for
window.parent.getElementById
__________________
All the Buddhas of all the ages have been telling you a very simple fact: Be -- don't try to become.
Kirtan is offline
Reply With Quote
View Public Profile Visit Kirtan's homepage!
 
Reply     « Reply to how to populate parent window from child window
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.84688 seconds with 12 queries