aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes accessing iframes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "accessing iframes" Watch "accessing iframes" New topic
Author

accessing iframes

swapnil paranjape
Ranch Hand

Joined: May 15, 2005
Posts: 126
when accessing iframes from parent page this works..

frames['ifrm'].document.body.innerHTML=txt;

following is the code:



but when same writeframe() function is written in extrenal JS file and used then i am getting error stating frame.document.body is null or not define...

following is the code...


[ August 17, 2005: Message edited by: Bear Bibeault ]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
You are calling it before the page is loaded. You need to call it onload.

Eric
swapnil paranjape
Ranch Hand

Joined: May 15, 2005
Posts: 126
that means i cant access iframe before the body in loaded(rendered)
so is this only applicable to iframes or also for pop up windows?
Yuriy Zilbergleyt
Ranch Hand

Joined: Dec 13, 2004
Posts: 429
Well, you can't write to a pop-up window before opening it either. If you call window.open(...) and then write to it, it should work - as long as you're not trying to modify some elements of the window before they are loaded (a DIV for example.) In that case you would probably need an onload in there as well.

-Yuriy
[ August 18, 2005: Message edited by: Yuriy Zilbergleyt ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: accessing iframes