|
-
Feb 7th, 2005, 04:44 PM
#1
Thread Starter
Addicted Member
How to pass values to a page with frames?
Can anyone tell me how to pass values to a page with frames.
From this other window the user would select a value. When they click on the value they want I call a javascript routine that will pass the values to the originating form that is still currently open on another window.
The code I currently have in the function:
function sendback() {
window.opener.frames[1].document.forms[0].txtSupplier.value = document.forms[0].txtSupplier.value
window.close()
}
This code does not seem to work for me though.
Can anyone please offer some help or suggestions.
Thanks again.
-
Feb 8th, 2005, 04:40 AM
#2
Re: How to pass values to a page with frames?
//irt.org
When opening the window using window.open, the new window is a child of the first window, although the first window is not the parent of the new window.
Make sure the window opening looks something like this:
Code:
<SCRIPT LANGUAGE="JavaScript"><!--
// This creates the popup window.
function MakeWindow() {
myWindow=window.open('','windowName','add you list of properties in here');
myWindow.href = 'apage.html';
if (!myWindow.opener) myWindow.opener = self;
}
//--></SCRIPT>
Then you can refer to the opener as opener:
Code:
alert(opener.location.href);
So you can simply go
Code:
opener.forms[0].txtSupplier.value = 'whatever';
-
Feb 8th, 2005, 10:58 AM
#3
Thread Starter
Addicted Member
Re: How to pass values to a page with frames?
I have no problems passing variables back in javascript, but this time I am passing variables back to a window that contains frames.
So in the javascript I will have to refer to the frames in one shape or another, but the code that I had posted in the first post is not working for me.
Do you have suggestions for the frames.
-
Feb 9th, 2005, 02:23 AM
#4
Re: How to pass values to a page with frames?
Did you try what I posted?
-
Feb 9th, 2005, 09:30 AM
#5
Thread Starter
Addicted Member
Re: How to pass values to a page with frames?
I did try it, it is what I have been doing for the other windows that open another window and receive a value from that newly opened window.
The problem is now is that the receiving window has frames. So simply opener.forms does not say which form as now the receiving window has 2 forms on it as well as 2 frames.
-
Feb 9th, 2005, 10:09 AM
#6
Thread Starter
Addicted Member
Re: How to pass values to a page with frames?
I figured it out. In my function to send back the value to the form with frames the javascript had to look like this:
window.opener.parent.frames[1].document.forms[0].txtField.value = strValue
The parent had to be there as the webpage that the frames are on is the parent.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|