View Full Version : body onload method

03-01-2003, 09:23 PM
Hi, I'm new to javascript, have a page with an inline frame that loads a shockwave file. I want the page to load first, then the inline frame. I'm not sure how to do this.

Would I put an onload parameter in the body tag of the page that references the file to be loaded in my inline frame? I tried several ways, including putting an <A> tag that targeted the iframe but no luck. Any suggestions would be helpful.

03-01-2003, 10:46 PM
assuming that your iframe is named "iFrame", then the best way to do this would be:

self.onload = function() {
self.frames['iFrames'].location = 'theFileYouWantToLoad.html';

self is another way of saying "window". so self.onload is the same as window.onload. self.frames[] is an array of all the frames in this window. iframes count as frames, so your iframe will be here. we get hold of it, by putting it's name in the box, and then we want it's location property, which controls what url the page has loaded.

hope that helps.

03-02-2003, 12:50 AM
Thanks! Works great.