473,406 Members | 2,377 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,406 software developers and data experts.

<frame> element IE 5 methods

I have a variable representing a <frame> element retrieved with
document.getElementById(); let's call it foo. The document that foo
contains has a script method called bar(). How can I call bar()
through foo? In compliant browsers, I can do

foo.contentWindow.bar();

and all is well. But what in the name of holy heck do I have to do to
get IE 5.01 to do the same thing? None of the following work...

foo.all.bar();
foo.document.bar();
foo.document.parentWindow.bar();

I'm truly grasping at straws here. I'd be very grateful for a clue.

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Jul 23 '05 #1
7 1379


Christopher Benson-Manica wrote:
I have a variable representing a <frame> element retrieved with
document.getElementById(); let's call it foo. The document that foo
contains has a script method called bar(). How can I call bar()
through foo? In compliant browsers, I can do

foo.contentWindow.bar();

and all is well. But what in the name of holy heck do I have to do to
get IE 5.01 to do the same thing?


You could go directly for the frame window object instead of for the
<frame> element object e.g. if you have
<frame name="frameName" src="whatever.html">
then
window.frames.frameName.bar()
works (in much more browsers than document.getElementById/contentWindow
works).
If you have
<frame id="frameId" src="whatever.html">
then I would guess that IE even gives you
window.frames.frameId.bar()
but that might not work in all browsers.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2
Martin Honnen <ma*******@yahoo.de> wrote:
You could go directly for the frame window object instead of for the
<frame> element object e.g. if you have
<frame name="frameName" src="whatever.html">
then
window.frames.frameName.bar()
I actually can't get that to work, even in IE6...

window.frames.frameName.contentWindow.bar();

works just fine, though, which leaves me in the same situation.
then I would guess that IE even gives you
window.frames.frameId.bar()


Also does not work, nor does

document.all.frameName.bar();

, which sounds mind-numbingly reasonable to me. I'd gratefully
welcome any further suggestions, since this problem just seems too
ridiculously simple to be so difficult... *scream*

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Jul 23 '05 #3
Christopher Benson-Manica <at***@nospam.cyberspace.org> wrote:
window.frames.frameName.contentWindow.bar();


For some absurd reason,

window.frames[1].bar();

works. Why would this work, but not

window.frames.frameName.bar();
window.frameName.bar();
document.all.frameName.bar();

? (Did I mention how much I despise IE 5?)

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Jul 23 '05 #4


Christopher Benson-Manica wrote:

window.frames[1].bar();

works. Why would this work, but not

window.frames.frameName.bar();
If you really have
<frame name="frameName" src="whatever.html">
then I am sure that works (of course once the frame is loaded but that
is not different for your code in the first line)
window.frameName.bar();
That should work too as long as there are no clashes between a global
variable named 'frameName'.
document.all.frameName.bar();


That is nonsense, as said you need to distinguish between a <frame>
element object (which document.all.frameName could give you) and a frame
window object. An element object does not have the functions in the
document as its properties, only the frame window object has.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #5
Martin Honnen <ma*******@yahoo.de> wrote:
If you really have
<frame name="frameName" src="whatever.html">
then I am sure that works (of course once the frame is loaded but that
is not different for your code in the first line)


I did, but of course I can't produce a minimal example that does the
same thing. Never fails...

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Jul 23 '05 #6
ASM
Christopher Benson-Manica wrote:
Christopher Benson-Manica <at***@nospam.cyberspace.org> wrote:

window.frames.frameName.contentWindow.bar();

For some absurd reason,

window.frames[1].bar();


parent.frames[1].bar();
or
parent.myFrameName.bar();

would both work if
bar() is in 2nd frame or in frame nammed 'myFrameName'
works. Why would this work, but not

window.frames.frameName.bar();
window.frameName.bar();
which window are you targetting ? (parent ? top ? self ? )
window is 'by default' and almost egal 'self.window'
the window you need is the 'parent.window'

Do :
parent.frames['frameName'].bar();
or
parent.frameName.bar();
work for you ?
document.all.frameName.bar();

? (Did I mention how much I despise IE 5?)


IE5 knows parent.myFrame.myFunction()

--
Stephane Moriaux et son [moins] vieux Mac
Jul 23 '05 #7
VK
You may want to read:
<http://www.geocities.com/schools_ring/ArrayAndHash.html#Legacy>

Jul 23 '05 #8

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

Similar topics

3
by: Jan Plastenjak | last post by:
This question is about html. I have this: <frameset rows="90%,10%" frameborder="NO" border="0" framespacing="0" cols="1"> <frame name="topFrame" noresize src="c:\bpp.xml"> <frame name="bottom" ...
3
by: D. Alvarado | last post by:
Hello, I am trying to find the <TITLE> element of my document. Normally alert(document.title); works just fine, but when this statement is within a page that is a frame in a larger document,...
34
by: Mark Moore | last post by:
It looks like there's a pretty serious CSS bug in IE6 (v6.0.2800.1106). The HTML below is validated STRICT HTML 4.01 and renders as I would expect in Opera, FrontPage, and Netscape. For some...
8
by: slim | last post by:
hi again all, i am still working on the website as mentioned in earlier threads and have hit another snag... http://awash.demon.co.uk/index.php http://awash.demon.co.uk/vd.css the php is...
2
by: Christopher Benson-Manica | last post by:
I would like to, for debugging purposes, obtain the contents of a <script> element. I'm aware that the text property contains the text contained within the element. However, the <script> element...
3
by: Gerhard | last post by:
Is it possible to embed a .pdf file inside <asp:Content></asp:Content>? I have a page that has a master page with navigation, etc., and I want the content to be what is in a .pdf file. Is this...
1
by: OriginalCopy | last post by:
This is a demonstrative code which could be used for debugging purposes. And yet I don't know how to insert the necessary data on line 63, purely syntactically speaking ? I'm a beginner with STL, and...
0
by: nish88 | last post by:
hi everybody...i'm trying to place an oval with a mouse click on my tkinter interface. can anyone please give me the code of how should i do it. i just want the part that i should add so that by...
1
by: volynetsv | last post by:
Hello. I have a small problem, here's code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.