Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6592153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:31:06+00:00 2026-05-25T17:31:06+00:00

I am trying to do some changes to a different frame using javascript, but

  • 0

I am trying to do some changes to a different frame using javascript, but I need to wait until it is properly loaded.

I have frame-B which does some changes to the content of frame-A. I have set a flag in frame-A when it has finished loading:

frame-A:

// Flag to indicate that the page is loaded. Used by frame-B
var documentLoaded = false;
$(document).ready(function () { documentLoaded = true; });

frame-B:

function onLeftFramesLoad(loops) {
    // Check if the menu frame is finished loading, if not try again in Xms.
    // To Avoid eternal loop if for some reason the documentLoaded flag is not set after Y seconds: break loop.
    if (!parent.frames[0].window || !parent.frames[0].window.documentLoaded && 
        loops < 40)
    {
        setTimeout(onLeftFramesLoad(loops + 1), 250);
        return;
    }
    // do changes to frame-A
}

// Using jQuery here to wait for THIS frame to finish loading.
$(document).ready(function() {
        onLeftFramesLoad(0);
});

My problem is that when frame-B loads before frame-A it doesn’t wait for frame-A to load. I.e. the setTimeout part doesn’t seem to work.

frame-B only takes about 30ms so it doesn’t time out.

Firebug gives me this message in the javascript console:

useless setTimeout call (missing quotes around argument?)

Tested in FF and chrome.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T17:31:07+00:00Added an answer on May 25, 2026 at 5:31 pm
    setTimeout(onLeftFramesLoad(loops + 1), 250);
    

    What this does is execute the return value of onLeftFramesLoad(loops + 1), so it executes onLeftFramesLoad before the setTimeout. this is basically the same as writing:

    setTimeout(undefined, 250); // onLeftFramesLoad always returns undefined
    

    undefined() doesn’t work, obviously. The correct way to do this would be

    setTimeout(function() {
      onLeftFramesLoad(loops + 1);
    }, 250);
    

    As this is a function and thus executable.

    For more info on the setTimeout function, check https://developer.mozilla.org/en/window.setTimeout

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a python program (using pyUNO ) to make some changes
I have some JavaScript that can appear on many different pages. Sometimes those pages
I am trying to implement some interface changes in my app, based on the
I'm currently trying to read in an XML file, make some minor changes (alter
I am working on SVN, and trying to commit some of the changes I
I'm writing some Javascript code and I'm trying to change the current page as
In my WPF application im trying to visualize some temperature data. I have a
I need help using Egit (Eclipse git integration capabilities). My goal is to have
I am trying to dynamically map JSON information into different objects. But I can't
I've been trying to smoothly animate some Windows Form location but I'm having some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.