473,394 Members | 1,867 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,394 software developers and data experts.

Obtaining ID of container IFrame

My HTML is shown in an iframe. There is a link in the HTML that needs
the ID of the iframe to be used in the onclick event. How do I get it?
I tried accessing the target property, but it turns out to be
undefined. Also I do not know the frame number in the parent's frame
collection. SO I cannot do parent.frames[2].id.

Please help.
Yash

Apr 12 '06 #1
1 1837


ya****@gmail.com wrote:
My HTML is shown in an iframe. There is a link in the HTML that needs
the ID of the iframe to be used in the onclick event. How do I get it?


By now there is wide support for
window.frameElement
so e.g.
if (window.frameElement) {
alert(window.frameElement.id);
}
will do in recent IE and Mozilla and Opera.
IE's documenation is here:
<http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/properties/frameelement.asp>
Supported there since IE 5.5.
I can't tell you the exact Mozilla and Opera versions from which on this
is supported.
You can always walk up to the parent window and parent.document and look
through the iframe elements.

And somehow your request sounds as if all you want is e.g.
<iframe name="frameName" src="whatever.html"></iframe>
and
<a href="whatelse.html" target="frameName">link</a>
but perhaps you really need script.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Apr 12 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: gsb | last post by:
Dynamically, I create a container DIV with an iFrame inside. When the iFrame content page is loaded, I would like to determine the ID, name DIV object reference of the "container" DIV with an...
3
by: hendedav | last post by:
Hi gang. As with any other post, I am working on a project and have gotten stuck. I am trying to obtain a variable value in the parent webpage from an <iframe>. For instance: Parent Page code...
3
by: Wade | last post by:
08242005 1416 GMT-5 Recently some of you helped me with a script to change images. Well I was asked to make a change to the script and not knowing if what the school system is even possible, Ill...
3
by: Guadala Harry | last post by:
Here's the functionality I'm after: I need for a page to display a photo. When users click on other links within the page, the photo changes. I'd like to swap out the photo without doing a...
3
by: Biff | last post by:
Hello, I am bringing up an iFrame with a calendar control in it in coordination with a text box that holds a date field. In my code behind class I add a method call to the text box's OnFocus...
19
by: derelicten | last post by:
hello , I have an issue positionating some pics I want to anchor to an existing table cell but I cant just place regular position on the cell because the background is fixed height and the set of...
8
by: Daz | last post by:
Hi everyone. I just wanted to know if there was any way to use script to display a list of methods linked to a particular object? The object I have in mind is getBrowser(), and I can't seem to...
1
by: draw | last post by:
I have one container page "container.htm" In this container I have multiple iframes "iframepage1.htm", "iframepage2.htm", etc. and one button firing a js script to submit. In every iframe page I...
6
by: honguin | last post by:
Hi, The current scenario is that I have an iframe inside an asp.net web page where I periodically check the url inside the iFrame. I know that all this information can be obtained in the...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.