SEO Scripts
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   SEO Chat ForumsOtherSEO Scripts

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread SEO Chat Forums Sponsor:
  #1  
Old February 12th, 2008, 04:57 AM
ali_ggl ali_ggl is offline
Registered User
SEO Chat Newbie (0 - 499 posts)
 
Join Date: Feb 2008
Location: http://www.GlobalGuideLine.com
Posts: 4 ali_ggl User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 53 m 17 sec
Reputation Power: 0
Talking Accessing the iFrame elements from other window.

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

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

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:

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.do  cument;

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
  #2  
Old March 13th, 2008, 07:14 AM
ali_ggl ali_ggl is offline
Registered User
SEO Chat Newbie (0 - 499 posts)
 
Join Date: Feb 2008
Location: http://www.GlobalGuideLine.com
Posts: 4 ali_ggl User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 53 m 17 sec
Reputation Power: 0
Talking Accessing frame or iframe elements like html form and its elements from outside.

Hi.

With this code inside a page we can access any form and out side page mean in frame or iframe we need an object variable of document such as

Code:
   var doc = top.frames[1].document;


Then with doc variable we can access all of the frame or iframe forms and elements. like below example

Code:
<html>
<head>
<script language="javascript">
function submitMe(){
	window.location=document.forms[2].txt.value;
}
</script>
</head>

<body>
<form>
<!--Nothing here-->
</form>

<form>
<!--Nothing here-->
</form>

<form>
<input type=text name="txt" value="http://www.google.com">
<input type=button value="Open Entered URL" onclick="submitMe()">
</form>

</body>
</html>


Ali.

Reply With Quote
Reply

Viewing: SEO Chat ForumsOtherSEO Scripts > Accessing the iFrame elements from other window.


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT