loading contents of external file into div via iframe

Discussion in 'Javascript' started by crescent_au@yahoo.com, Dec 6, 2006.

  1. Guest

    Hi all,

    I am trying to load contents of external html file into div but I am
    not able to do it. However, using onclick to call the same function
    works.

    My code is attached below. Please read comments on UPPERCASE.

    <iframe id="features" name="features" src="products/toys/features.html"
    style="display:none;"></iframe>

    <span><a href="#" onmouseout="MM_swapImgRestore()"
    onmouseover="MM_swapImage('Image35','','images/buttons/rollover/feature_rollover.jpg',1)"><img
    src="images/buttons/features.jpg" name="Image35" width="85" height="18"
    border="0" id="Image35" onclick="load_text('features')" /></a></span>
    <!-- HERE load_text() WORKS -->

    <div id="textChange"></div>
    <script language="javascript">load_text('features');</script><!-- HERE
    load_text() DOESN'T WORK -->

    ---------------------------
    // .js file
    function load_text(buf) {
    document.getElementById('textChange').innerHTML =
    eval('window.frames.'+buf+'.document.body.innerHTML');
    }
     
    , Dec 6, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Some One
    Replies:
    5
    Views:
    814
    Toby A Inkster
    Aug 9, 2003
  2. Daedalous
    Replies:
    3
    Views:
    712
    Daedalous
    Jan 16, 2004
  3. Andy Roger
    Replies:
    1
    Views:
    148
    Baconbutty
    Dec 2, 2004
  4. Mel
    Replies:
    1
    Views:
    240
    Martin Honnen
    Jun 8, 2005
  5. jon
    Replies:
    10
    Views:
    267
    Evertjan.
    Dec 6, 2006
Loading...

Share This Page