Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Iframe chain

Status
Not open for further replies.

iggitme

IS-IT--Management
Sep 13, 2006
47
US
I have a series of iframes. I would like to have each one, as it loads, to fire off the loading of the next one. I have tried many varieties of js reloads, url etc... is there a simple line of code that will do this ... so far:

window.frames[publish].location = url; dies, as they all do, saying the iframe id/name of 'publish' is not found.. but it sits right above the iframe this is in... have also tried element by id.... so....

ah...... wits end... and thank you for your support!
 
Try setting the onLoad event of each frame to load the next one.

<iframe onLoad="window.frames['publish'].location='url'">


----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
This works by iframe 'a' containing a form, which upon submit winds up in iframe 'b', then iframe 'b' needs to automatically fire off iframe 'c' to reload ('tis a tracking results ah... result)
 
Iframe C does not exists within iframe B. but inside Iframe B's parent.

So if you are calling the frames.location from within iframe b you need to first reference its parent since that;s hwere the other iframes are.

parent.window.frames['publish'].location=url


----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
vacunita: thank you for the reply and idea.. i tried it and got 'permission denied'......... now i know what bliss means
 
Sounds like your browser can't reload whatever is supposed to be shown in that frame.

Which no longer has anything to do with Js, but with your server settings.

If its a server side language such as PHP or ASP, it could point to a configuration problem.


----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Well i've been trying variations... most everything comes up access denied.. that was in changing from a refresh to a send the whole url to load it... i'm just not able to access that iframe.. i can get it to popup a new window as a result, but not target the iframe

this has to be a standard problem somebody has already solved.. not that i'm lazy or anything like that
 
Yes they are, actually the same script.

parent ...
............iframe a
............iframe b
............iframe c

form in iframea fires sends to display in iframe b, where upon load fires off iframe c (which is really nothing but a refresh of iframe c)

only that whole iframe 'c' thing.... ain't workin'
 
Here's an example I put together.
Its very simple, but illustrates how it should be working:

Code:
<body>
<iframe name="frame1" src="form1.php" style="width:200px; height:200px;">Loading...</iframe>
<iframe name="frame2" src="process.php" style="width:200px; height:200px;">Loading...</iframe>
<iframe name="frame3" src="display.php" style="width:200px; height:200px;">Loading...</iframe>
</body>


Code:
<form action="process.php" method="POST" [red]target="frame2"[/red]>
<input type="text" name="forum">
<input type="text" name="keywords">
<input type="submit" name="send" value="Process Values">
</form>

Code:
<body [red]onLoad="parent.window.frames['frame3'].location='display.php'"[/red]>

<?PHP
code that adds the values from the form to a DB
?>
</body>

Code:
<?PHP

Code to display data from DB

?>



Basically this illustrates what I understood to be your process.

The Parent Page Loads 3 Iframes. Iframe one contains a form that upon submission targets iframe2 to have the values from the form be processed (I used PHP, but the process can be anything at all), and inserted into a DB. Once that is done, iframe2 executes the JS call to reload iframe3.

All iframe3 does is connect to a Db and display data from a table. Since it gets refreshed by iframe2 it will display whatever was added.

With that said, if you are getting a Permission Denied page in your iframe3, it means that somehow either your process does not have the correct rights to refresh the page in iframe3, or whatever is running there is having problems.

JS is doing what its supposed to at this point and attempting to reload the page.

Does opening the page in iframe3 by itself work fine?


----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Thank you so much for the great example. Yes '3' is refreshed from form elements, not in iframes, this is the only place that has that pesky chain in place, once a is submitted it targets b and upon load b fires off c, and you got that exactly correct on what it is doing...

 
Have tried your suggestion: permission denied was the standard response. I can get the result to go to a new window, but any attempt , in any way, to target that pesky iframe is permission denied.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top