Reputation: 6884
Here's the situation.
function scrollLog(line) { // Assume Firefox
// alert("weird");
frames['log'].find(line);
};
Here's a function I call when the document is ready. The code as written does not always fire . However, uncomment the alert line, and after the alert is fired, the find function always fires. Any ideas?
EDIT: Could this possibly be due to a load() issue where the timing of the loading of the iframe is not complete all the time? (These are pretty big log files)
Thanks,
Michael
Upvotes: 1
Views: 199
Reputation: 66485
Often adding an alert will do funky stuff when javascript tries to communicate with something else. I experienced this with flash, when putting alerts would leave time for the flash to load and it would work. Removing the alert would break everything.
Here I'd say since you put an alert it give time to the frame to load and therefore you're able to access it. When you don't have an alert, it might not be loaded completely. Tries to check if the frame is loaded before accessing it.
Upvotes: 2
Reputation: 4521
I think the issue might be that the main document dom could be loaded before the iframe's document DOM is loaded.
Have you tried basing it on the frames element?
$(frames['log']).ready( function () {});
Upvotes: 1