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

top.frames[1].location.href not working: fetch frame name during runtime

P: 40
Hi All
My" Frame .html " page is divided in to header and client frames and in my client frame i am loading "client.html" page, and this client .html is divided in to multiple frames,

when i click any on link in the client.html,it should load the url of the link in the client frame, ir respective of the frame in which the link resides in the client.html,

hence i used

top.frames[1].location.href=link_url;
this is not working

But if i use
top.frames["framename"]=link_url
it works fine

i don want to use the name, can any one help me please?
Jul 6 '08 #1
Share this Question
Share on Google+
10 Replies


hsriat
Expert 100+
P: 1,654
According to w3schools, it would return references of the named frame only. So if the second frame of your page doesn't have any name, it won't be returned with frames[1].
Jul 6 '08 #2

P: 40
i have named my frame, as CLIENT eventhough if i use
top.frames[1].location.href=link_url; i am getting object expected error, and i checked window.frames.length before the line top.frames[1].location.href usig alert, and that retured 1, but i expected more than 2, since my

My" Frame .html " page is divided in to header and client frames and in my client frame i am loading "client.html" page, and this client .html is divided in to multiple frames,

i don understand what is happening, i am expecting your advice :)
Jul 8 '08 #3

acoder
Expert Mod 15k+
P: 16,027
Post your HTML frame code. Also, have a look at this link.
Jul 8 '08 #4

P: 40
Hi Guys, I'm back , sorry was pulled in to some other issue,

And this issue was yet unresolved.

top.frames[1].location.href=page_url; is still not working,

But i have found one thing, it works in IE(version 6), it is not working in fire fox only.

Can any one hep me.


i am not able to paste the entire code, due to some safty measures :(
Jul 22 '08 #5

P: 40
Hi all
In the below syntax,
top.frames["framename"].location.href

i don want to hard code the frame name, Instead is there any way in which i can dynamically fetch the name of the frame in a html file using javascript?

Any of ur advise would be much helpful to me
Jul 22 '08 #6

P: 40
Hi all
the below syntax,

top.frames[1].location.href not working is not working in fire fox

but the below works
top.frames["framename"].location.href


i don want to hard code the frame name, Instead is there any way with which i can dynamically fetch the name of the frame in a html file using javascript?

Any of ur advise would be much helpful to me
Jul 23 '08 #7

P: 57
top.frames[1].location.href not working is not working in fire fox
Have you tried
Expand|Select|Wrap|Line Numbers
  1. top.frames[0].location.href 
Jul 23 '08 #8

P: 40
hi
Thanks for the reply, I tried top.frames[0].location.href that also does not work
Jul 23 '08 #9

acoder
Expert Mod 15k+
P: 16,027
Just post some relevant code, e.g. how you've declared the frame tag, where and how you're calling the code.
Jul 29 '08 #10

acoder
Expert Mod 15k+
P: 16,027
Merged threads. Please do not double post your questions.
Jul 29 '08 #11

Post your reply

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