473,473 Members | 1,750 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Problems with referencing javascript windows


Folks,

I have a javascript function which is a popup - It contains a list in
form tags - When the user selects a value in the popup, and clicks
submit, I want the values to be transfered to the parent opening window.

I have managed this when I know the name of the parent window - however
there are two or three different 'parent' forms with different form
names that could reference this popup session meaning my current
solution only works for one, but not the others.

My question therefore is, how, without knowing the parent window name,
can I write a value to a form input tag field.

I'm a newbie - part of me thinks I could pass my window name using the
special 'this' reference - but I'm not quite sure - Can someone help
direct me in the right direction?

Cheers
Randell D.
Jul 23 '05 #1
4 1494
window.opener

In article <mF2Kd.186761$6l.69943@pd7tw2no>,
re******************************@fiprojects.moc says...

Folks,

I have a javascript function which is a popup - It contains a list in
form tags - When the user selects a value in the popup, and clicks
submit, I want the values to be transfered to the parent opening window.

I have managed this when I know the name of the parent window - however
there are two or three different 'parent' forms with different form
names that could reference this popup session meaning my current
solution only works for one, but not the others.

My question therefore is, how, without knowing the parent window name,
can I write a value to a form input tag field.

I'm a newbie - part of me thinks I could pass my window name using the
special 'this' reference - but I'm not quite sure - Can someone help
direct me in the right direction?

Cheers
Randell D.

Jul 23 '05 #2
Randell D. wrote:
When the user selects a value in the popup, and clicks
submit, I want the values to be transfered to the parent opening
window.


Here is a working example:
http://www.innoline-systemtechnik.de...op_opener.html

ciao, dhgm
Jul 23 '05 #3
Lee
Randell D. said:


Folks,

I have a javascript function which is a popup - It contains a list in
form tags - When the user selects a value in the popup, and clicks
submit, I want the values to be transfered to the parent opening window.

I have managed this when I know the name of the parent window - however
there are two or three different 'parent' forms with different form
names that could reference this popup session meaning my current
solution only works for one, but not the others.

My question therefore is, how, without knowing the parent window name,
can I write a value to a form input tag field.

I'm a newbie - part of me thinks I could pass my window name using the
special 'this' reference - but I'm not quite sure - Can someone help
direct me in the right direction?


A reference to the window that opened the current window is
found as window.opener.

window.opener.document.forms[0].elements["startDate"].value= ...

Jul 23 '05 #4
Randell D. wrote:

Folks,

I have a javascript function which is a popup - It contains a list in
form tags - When the user selects a value in the popup, and clicks
submit, I want the values to be transfered to the parent opening window.

I have managed this when I know the name of the parent window - however
there are two or three different 'parent' forms with different form
names that could reference this popup session meaning my current
solution only works for one, but not the others.

My question therefore is, how, without knowing the parent window name,
can I write a value to a form input tag field.

I'm a newbie - part of me thinks I could pass my window name using the
special 'this' reference - but I'm not quite sure - Can someone help
direct me in the right direction?

Cheers
Randell D.


I got it... I just needed some rough direction because objects and DOM's
and whatever seem to go,for the most part, over my head - However, if
someone else is curious on the solution, here goes...

In my parent window, a new popup window is opened, and named, using
window.open()

In my new (child) window, I found I could reference or change the value
in an INPUT tag in the parent calling window using the following
declaration:

window.opener.document.forms[0].myParentInputTagName.value="whatever";

Thus, using the above bit of javascript - when contained in my child
window would lead my parent form, which would contain an <INPUT
NAME="myParentInputTagName"> to have the value "whatever" assigned to it.

randell d.
Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: Robert Mark Bram | last post by:
Hi All! Is there a way to reference a window by name without doing something like this: open (, 'windowName'); The open method will open a blank window if there is no window with such a name....
2
by: Reply Via Newsgroup | last post by:
Folks, Windows, and refering to them (be they in seperate frames or in a popup) always catch me... There is parent, top, self, the name of the window itself and where it sits when refering to...
3
by: Morten Thorsen | last post by:
Hi frame experts c",) Hope you can help me out on this one I've got a frameset (index.html) on my server (server A) defining two frames. Left frame is named "menu" and contains a page (menu.html)...
5
by: Mike | last post by:
I have created a solution with 3 projects, P1, P2, P3. Project P1 has my main method and it also relies on objects/classes from P2 and P3. Two Questions: 1. P2 and P3 don't have main methods. ...
3
by: Lyners | last post by:
I have a table within a cell of a datagrid. I am doing updates without postback to the server using Javascript. I have everything working, except referencing a table within the datagrid cell. ...
2
by: Suzanne | last post by:
Hi all, I'm reposting this message as I'm experiencing this problem more and more frequently : I really hope someone out there can help me as I've been tearing my hair out on this one for a...
3
by: libsfan01 | last post by:
Hi all whats wrong with this script? i have named a form text box dynamically using php each row has a textbox called q101, q102 ... etc and i want to make sure my users dont input a quantity...
14
by: julie.siebel | last post by:
I've been wrestling with a really complex page. All the data is drawn down via SQL, the page is built via VBScript, and then controlled through javascript. It's a page for a travel company that...
18
by: coachjerry | last post by:
I'm a senior citizen with a tech background, though a newbie to programming and style sheets. I'm usually able to make HTML and css changes to existing designs, but I'm stuck on this one and would...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.