473,320 Members | 2,097 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Controlling parent window from iFrame

Hey guys,

I'm in the last steps of my project, just a small question here. What
I'm doing right now is using an iframe to populate my drop-down
listboxes and have them display dynamic information from the database.
What I'm trying to do is change the selectedIndex from the iFrame.
Here's a quick snippet of code:

<SCRIPT LANGUAGE="JavaScript">
function testFunc() {
var empID =
document.form1.ddlEmployee.options[document.form1.ddlEmployee.selectedIndex].value;
document.frames("iframequery").location.href=
"/queries.cfm?EmployeeID=" + empID;
return false;
}
</SCRIPT>

<SELECT NAME="ddlEmployee" onChange="return testFunc();">
<OPTION VALUE="">Employee</OPTION>
<CFOUTPUT QUERY="qryEmployee">
<OPTION VALUE="#EmployeeID#">#FirstName# #LastName#</OPTION>
</CFOUTPUT>
</SELECT>

Then, in queries.cfm...

<SCRIPT LANGUAGE="JavaScript">
function refreshWindow() {
parent.window.ddlLocation.setSelectedIndex = 2;
}
</SCRIPT>

....

<BODY ONLOAD="refreshWindow();">

Now, when I call refreshWindow(), I'm getting this error:

'parent.window.ddlLocation' is null or not an object

Anyway, if anyone knows how I can get this to work (setting the drop
down list from the iframe), I would really appreciate it.

Thanks!
Josh.

Jul 28 '05 #1
1 1892
Never mind, I got it working.

I just created a function in the parent window called
changeLocation(loc) and called it from the iframe, passing through the
variable from queries.cfm.

Jul 28 '05 #2

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

Similar topics

1
by: James Wallace | last post by:
I need to know how to change the src property of an iframe from script that is executed in another iframe with both of these iframes being contained on a document which is then contained by another...
26
by: Dave Hammond | last post by:
In document "A.html" I have defined a function and within the document body have included an IFRAME element who's source is document "B.html". In document "B.html" I am trying to call the function...
2
by: Jeronimo Bertran | last post by:
Hi, I have a page with a very data intensive grid which needs to be automatically refreshed constantly if a change is detected. In order to not refresh the complete page so often, I created an...
6
by: paul | last post by:
HI! How do we send a variable from an Iframe page back to its parent? I have a script that calculates the iframe's window size but I need to know how to send that value back to its parent so I...
4
by: Jayyde | last post by:
Is there any way to capture a button click inside an iFrame and perform both an action on that page and one on the parent page? Basically I have a page atm that allows the user to add a record to...
0
by: LudwigWrules | last post by:
I have an iframe on my site. I need the frame to display its "child" page at a specific point. I can do this by setting an anchor, but it makes the parent window go there, too. I was thinking of just...
1
by: Bhishm | last post by:
Hi, I have a window (192.168.1.223/test.ph) in which one iframe continuously runs. I open another window from that window (192.168.1.223/test1.php) which also runs an iframe continuously. ...
1
by: Bali | last post by:
Default.aspx is the starting page containing a control(ascx) which has asp:button control on it. On the button click event it has to open a new page as a modal control. Since refreshing a page in...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.