SunQuest
 
           JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old December 28th, 2004, 06:13 PM
Pheifel Pheifel is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Location: Denmark
Posts: 174 Pheifel User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 43 m 46 sec
Reputation Power: 5
Send a message via MSN to Pheifel
child window link values

Hi.

I need to have a link in a child window, to set the value of a input[text] in the parent window.

how do i do this ??

- Pheifel

Reply With Quote
  #2  
Old December 29th, 2004, 09:54 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 4 m 48 sec
Reputation Power: 8
I made up a working example of this.
I love Javascript DOM! =)

This first page would be your parent window. It contains a form with a text box.
Code:
<html>
<head>
<title>Page</title>
</head>

<body>
<h1>Form with Popup Example</h1>

<p><a href="#" onclick="javascript:window.open('pop.htm','mypop','width=15  0,height=210');">Popup Window</a></p>

<form>
<input type="text" name="input1" /><br/>
<input type="submit" />
</form>
</body>
</html>



This second page would be your popup window. I made it have a link which sets the text directly. You may want the text to come from a Form element in the popup window, but I assume you are capable of doing that yourself.
I've named this pop.htm, if yuo name it something different, be sure to change the window.open command in the parent window.

Code:
<html>
<head>
<title>Page</title>
<script>

function setParentText(str) {
	window.opener.document.bgColor = "beige";
	window.opener.document.forms[0].elements[0].value = str + '';
	window.opener.restart();
	//window.close();
}

</script>
</head>

<body>
<h1>Popup Form</h1>


<a href="#" onclick="javascript:setParentText('Hello world');">Click here to set the text</a>
</body>
</html>

Reply With Quote
  #3  
Old December 29th, 2004, 09:55 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 4 m 48 sec
Reputation Power: 8
vBulletin has put a weird space in this line:
javascript:window.open('pop.htm','mypop','width=15 0,height=210'); on my parent window... that should read 150, without the spaces.

Reply With Quote
  #4  
Old December 30th, 2004, 03:58 PM
Pheifel Pheifel is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Location: Denmark
Posts: 174 Pheifel User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 43 m 46 sec
Reputation Power: 5
Send a message via MSN to Pheifel
thnx a bunch thats nice it works like a charm

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > child window link values


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway