www.webdeveloper.com
Recent Articles
  • Finding Slow Running Queries in ASE 15
  • A More Advanced Pie Chart for Analysis Services Data
  • Adobe AIR Programming Unleashed: Working with Windows
  • Performance Testing SQL Server 2008's Change Data Capture Functionality
  • The ABC's of PHP: Introduction to PHP
  • How to Migrate from BasicFiles to SecureFiles Storage
  • Why the Twitter Haters Are Wrong
  • User Personalization with PHP: Beginning the Application
  • Whats in an Oracle Schema?
  • Lighting Enhancement in Photoshop
  •  

    Go Back   WebDeveloper.com > Client-Side Development > JavaScript

    JavaScript JavaScript (not Java) Discussion and technical support, including AJAX and frameworks (JQuery, MooTools, Prototype...)

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1  
    Old 01-11-2007, 03:40 PM
    Andante Andante is offline
    Registered User
     
    Join Date: Jan 2007
    Posts: 7
    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.
    Reply With Quote
      #2  
    Old 01-11-2007, 05:49 PM
    Mr J Mr J is offline
    Registered User
     
    Join Date: Apr 2003
    Location: UK
    Posts: 2,203
    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.
    Reply With Quote
      #3  
    Old 01-15-2007, 12:34 PM
    Andante Andante is offline
    Registered User
     
    Join Date: Jan 2007
    Posts: 7
    Smile Thank You

    Mr. J

    I came back today and applied your solution.....works perfectly. Thank You for the help and the examples.
    Reply With Quote
    Reply

    Bookmarks


    Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
     
    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is Off
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 03:14 PM.



    Acceptable Use Policy


    The Network for Technology Professionals

    Search:

    About Internet.com

    Legal Notices, Licensing, Permissions, Privacy Policy.
    Advertise | Newsletters | E-mail Offers

    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.