|
|||||||
| JavaScript JavaScript (not Java) Discussion and technical support, including AJAX and frameworks (JQuery, MooTools, Prototype...) |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Reference an external Iframe
Hello everyone,
We have an HTML page which contains an Iframe where a specified HTML file will load. We would like to load a specific *.HTML into the Iframe based on a condition. This condition comes from a button pushed in our Flash movie and the variable is passed into Javascript. In Javascript, here is the condition to load the main page (solutions.html): if(linkobj=="somemovie1.flv") { location.href="html/solutions/solutions.html"; } else if (linkobj=="vid2.flv") { ... } else if (linkobj=="vid3.flv") { ... } else if (linkobj=="vid4.flv") { ... On the solutions.html page, our Iframe is defined as: <iframe src="page1.html" frameborder="0" name="content" width="850" height="410" scrolling="yes"></iframe> I would like to have either page1.html, page2.html, page3.html load up based on a javascript condition. I have so far tried: window.main.frames['content'].location.replace('html/solutions/page1.html'); --- frames.location.href="html/solutions/page1.html"; -- window.frames.content.location="html/solutions/page1.html"; -- document.write("<iframe src='html/solutions/page1.html' frameborder='0' name='content' width='850' height='410' scrolling='yes'>"); //document.write("</iframe>"); -- Appreciate the help, and thank you in advance for your time. |
|
#2
|
|||
|
|||
|
Give the following a try
In solutions.html function loadIframe(){ if (location.search.length > 0){ loc=unescape(location.search.substring(1)) window.frames["content"].location=loc } } // add onload="loadIframe()" to the opening BODY tag Your condition would then be if(linkobj=="somemovie1.flv") { location.href="html/solutions/solutions.html?page1.html"; } else if (linkobj=="vid2.flv") { location.href="html/solutions/solutions.html?page2.html"; For an example see http://www.huntingground.freeserve.c...rame_load6.htm
__________________
The Silent One The most dangerous thing in the world is an idea. The most dangerous person in the world is one with an idea Last edited by Mr J; 01-11-2007 at 05:54 PM. |
|
#3
|
|||
|
|||
|
Mr. J
I came back today and applied your solution.....works perfectly. Thank You for the help and the examples. |
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|