By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
460,045 Members | 1,339 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 460,045 IT Pros & Developers. It's quick & easy.

Determining frame's name

P: n/a
Hello,

Firstly, I'm not good at JS, so please be patient :)

I have a quite complicated page structure, where a lot of frames are
created dynamically (same applies to their names). How can I make each
of these frames print itself's name e.g. using alert? I know the name
of the parent frame, and I can include any js in each dynamically
created frame's header.

I've tried using self.name, window.name... but I always get "undefined"
result. Any suggestions?

Audrius

Sep 1 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
In fact self.name and window.name dosn't work with IE... Using firefox
everything works fine. I can get frame's name using self.name.

Does anyone has any idea how to determine frame's name using IE ?

Thanks,
Audrius

Sep 1 '05 #2

P: n/a


Audrius wrote:

I have a quite complicated page structure, where a lot of frames are
created dynamically (same applies to their names).


What exactly are you trying to use to create a frame dynamically?
var iframe = document.createElement('iframe');
iframe.name = 'someName'
It is known that for IE/Win that fails to give the created element a
name attribute.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Sep 1 '05 #3

P: n/a
Thanks for your reply.

I'm not creating frames myself. And I don't have any impact on their
creation (thus I can't select a frame name I want to use). I can only
affect the contents of those created frames, by executing my code in
them, which is actually generated with JSP (in this case it doesn't
matter).

I have a header frame... It's a place which I intend to change to add a
registry for those frames. Header frame is static and is used to hold
"global" variables or values... (I can change header's js)... So each
frame content should have a function that places it's name in header.
That's what I want to acomplish. To register all frames in header. And
to do that I need to determine frame's name on rendering. As I said, in
Firefox I can get it using self.name. With IE it doesn't work for me.

Thanks,
Audrius

Sep 1 '05 #4

P: n/a
tom
could you publish your page, to see what do u mean?
or paste the source code to figure out the problem?

I can say this in advance:

To find out how many frames are currently active in a window, use this
expression: parent.frames.length

This expression returns a number indicating how many frames the parent
window defines. This value does not, however, count further nested
frames, should a third generation of frame be defined in the
environment.

Therefore, if the window shows three frames (whose indexes are
frames[0], frames[1], and frames[2], respectively), the reference for
retrieving the title property of the document in the second frame is
parent.frames[1].document.title

This reference is a road map that starts at the parent window and
extends to the second frame's document and its title property. Other
than the number of frames defined in a parent window and each frame's
name (top.frames[i].name)

I hope this helps
Tom

Sep 1 '05 #5

P: n/a

Audrius wrote:
to do that I need to determine frame's name on rendering. As I said, in
Firefox I can get it using self.name. With IE it doesn't work for me.


That is odd as window.name is certainly a property IE implements for
windows and frames. I think you need to post a URL where the problem
occurs to allow us here to try to find out why it does not work and
hopefully find a way to get it to work.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Sep 1 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.