Geeks Talk

Prepare for your Next Interview




Accessing the iFrame elements.

This is a discussion on Accessing the iFrame elements. within the JavaScript forums, part of the Web Development category; I am trying to access the content of my iframe src page. Something like below document.getElementById('myFrame').contentWindow.document; It works fine on a predifined iframe element, However, when ...


Go Back   Geeks Talk > Web Development > JavaScript

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 02-06-2008
Junior Member
 
Join Date: Feb 2008
Location: http://www.GlobalGuideLine.com
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
ali_ggl is on a distinguished road
Accessing the iFrame elements.

I am trying to access the content of my iframe src page. Something
like below

document.getElementById('myFrame').contentWindow.document;

It works fine on a predifined iframe element, However, when creating
the iframe element
dynamically, and appending it to the body, I can't access the content
when doing this dynamic insertion. My guess would be that this is
because the iframe element doesn't yet exist on the Dom. See example
of problem below:

var myFrame = document.createElement("iframe");
myFrame.id = "testID";
myFrame.name = "testID";
myFrame.src = "testPage.htm";
myFrame.frameBorder = "0";

document.body.appendChild(myFrame);

//code below isn't working due to the above
document.getElementById('testID').contentWindow.document;

Does anyone have any example to access the elements of iFrame or Frame in browser
so I can do to resolve this issue?

Thanks
Ali
Reply With Quote
Sponsored Links
Reply

  Geeks Talk > Web Development > JavaScript


Thread Tools
Display Modes


Similar Threads

Thread Thread Starter Forum Replies Last Post
Accessing UNIX prompt from QTP sirip19 QTP 0 01-09-2008 02:01 AM
Accessing Row from table dgopinath_1974 Oracle Certification 1 11-22-2007 04:08 PM
Restriction of accessing sites dgopinath_1974 Web Design 0 11-22-2007 10:56 AM
Accessing Dom elements in LoadRunner Sammy Reva LoadRunner 0 09-11-2007 08:45 PM
access outside data from iframe... psuresh1982 Web Design 0 07-31-2007 05:11 AM


All times are GMT -4. The time now is 07:55 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Copyright © 2008 GeekInterview.com. All Rights Reserved