UK SEO and Internet Marketing Forums
Accessing the Frame items from other frame.

December 02, 2008, 03:12:24 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: We are back and we've changed software
 
   Home   Help Search Login Register  
Del.icio.us Digg FURL FaceBook Stumble Upon Reddit SlashDot

Pages: [1]
  Print  
Author Topic: Accessing the Frame items from other frame.  (Read 1620 times)
ali_ggl
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 1


View Profile WWW
« on: February 12, 2008, 11:02:02 AM »

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:
:lol:
Code:
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?
:shock:
Thanks
Ali
Logged

Pages: [1]
  Print  
 
Jump to:  

Powered by SMF | SMF © 2006-2008, Simple Machines LLC | Sitemap Valid XHTML 1.0! Valid CSS!


Google visited last this page November 15, 2008, 04:17:58 PM