Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

accessing iframes

 
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are calling it before the page is loaded. You need to call it onload.

Eric
 
swapnil paranjape
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 429
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
    Bookmark Topic Watch Topic
  • New Topic