access another frame by one frame

A

Angus the Fighter

dear talented boys and girls,

i have some problems in writing javascript in the following situation:
could anyone tell me whats wrong with this:

window.parent.frames[2].src;

why it display as "undefine"?

angus
 
K

kaeli

dear talented boys and girls,

i have some problems in writing javascript in the following situation:
could anyone tell me whats wrong with this:

window.parent.frames[2].src;

What were you looking for? I don't recall seeing a .src property for a
window object.
Assuming MSIE compliance, there is no src property of window.
<http://msdn.microsoft.com/library/default.asp?
url=/workshop/author/dhtml/reference/objects.asp>

Perhaps you meant location?
Note: location is also an object. If you want the URL as a string, use
window.location.href.

Also, keep in mind that arrays are 0-based in JS.
frames[0], frames[1], etc.
frames[2] is the THIRD frame in the frameset.

You're really better off using names.
Name the frame in the frameset, then use
frames['theNameOfTheFrame']

That way, if they get moved around, you don't have to change anything.

HTH
--
--
~kaeli~
She was engaged to a boyfriend with a wooden leg but broke
it off.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
 
A

Angus the Fighter

it works!

thx a lot!

angus

kaeli said:
dear talented boys and girls,

i have some problems in writing javascript in the following situation:
could anyone tell me whats wrong with this:

window.parent.frames[2].src;

What were you looking for? I don't recall seeing a .src property for a
window object.
Assuming MSIE compliance, there is no src property of window.
<http://msdn.microsoft.com/library/default.asp?
url=/workshop/author/dhtml/reference/objects.asp>

Perhaps you meant location?
Note: location is also an object. If you want the URL as a string, use
window.location.href.

Also, keep in mind that arrays are 0-based in JS.
frames[0], frames[1], etc.
frames[2] is the THIRD frame in the frameset.

You're really better off using names.
Name the frame in the frameset, then use
frames['theNameOfTheFrame']

That way, if they get moved around, you don't have to change anything.

HTH
--
--
~kaeli~
She was engaged to a boyfriend with a wooden leg but broke
it off.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top