473,385 Members | 1,353 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Accessing IFrame anchors

dorinbogdan
839 Expert 512MB
Let's say that my IFrame has id="container".
I can get a reference to it using
Expand|Select|Wrap|Line Numbers
  1. var ref = document.getElementById("container");
I can get an array of all elements using:
Expand|Select|Wrap|Line Numbers
  1. ref.document.all
But, how can I get just anchor elements of ref, without looping through all elements? is there a getElementsByTagName() method or other way?

Thanks,
Dorin.
Apr 19 '07 #1
2 1291
mrhoo
428 256MB
var ref = document.getElementById("container");

var refdoc=ref.contentWindow.document;

refdoc returns the document in the window contained by the Iframe.
As long as it is in the same domain as the parent page, you can use all of the documen methods you would have access to if you opened the document directly.

to get the links-
var linklist=refdoc.getElementsByTagName('a')
or
var linklist=refdoc.links
Apr 19 '07 #2
dorinbogdan
839 Expert 512MB
Thanks for help, I just found it too.

God bless you,
Dorin.
Apr 19 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: splish | last post by:
Hello, I have the following problem: An Iframe exists inside a page (that has content exceeding the height, therefore scrollbars kick in) - normal stuff. When I want to use anchor references...
3
by: Sascha Möllering | last post by:
Hi, I have a website displayed in an iframe with anchors (it`s a navigation tree) an every time I click on an object in my navigation tree, the whole website moves. Is it possible to move the...
1
by: R | last post by:
Hello, I have a frame in which there are 2 IFrames., both being loaded from the same domain. One IFrame is loaded from http://test1.xyz.com and the other IFrame is loaded from...
3
by: Greg | last post by:
Javascript Folks, I am relatively new to javascript and am working on a script where I want to utilizes a couple of iframes and format text in them. I have run into a problem with getting the...
4
by: Paul Brant | last post by:
Hi all, I have a page with an IFRAME in it. From a script in the main ( parent ) page I instruct the IFRAME to load a specific URL. The URL contains parameters that are processed by the server....
14
by: Aaron Gray | last post by:
Hi, I want to access the properties of an IFrame but seem unable to get access to the IFrames document body. <html> <body> <iframe src="test.html" id="IFrame"></iframe> </body>
4
by: stephen.cunliffe | last post by:
Hi all, There's been a bunch of chatter recently about using the Object tag, vs. the Iframe tag. I couldn't care less which one is used, I just want to be able to load a "page" inside another...
2
by: knkk | last post by:
I have an iframe in a page (with a name to the iframe), and in that iframe I have several anchors <a name="something"> There are links in the iframe that look like <a href="#something"> ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.