Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

target an IFRAME inside a DIV in a regular frame from other frames? 1

Status
Not open for further replies.

plectrum

Programmer
Feb 16, 2004
21
0
0
US
Hi,
I try access an iframe(name=iFrameName)inside a DIV in frame_A from frame_B.
In frame_B, I have <body onLoad="parent.frame_A.document.iFrameName.location.href='newpage.htm';"> , but it doesn't work. Please help, thanks in advance.

plectrum
 
Try this:
Code:
<body onLoad="parent.frame_A.iFrameName.document.location.href='newpage.htm';">

Or this
Code:
<body onload="window.open('newpage.htm','iFrameName')">



Adam
while(ignorance){perpetuate(violence,fear,hatred);life=life-1};
 
Adam,
Thx a lot for the help.Now it works for all the browsers except for KDE's Konquoror, seems it ignores '.iFrameName.document', and for window.open() method, Konqueror just opens a new pop up window instead of sending to the target iframe. I have no clue.

Plectrum
 
Hmm, I've never used Konqueror before. Maybe it considers the location object to be an invalid child of the document object. You could give this a try:
Code:
<body onLoad="parent.frame_A.iFrameName.location.href='newpage.htm';">

Adam
while(ignorance){perpetuate(violence,fear,hatred);life=life-1};
 
Finally got it to work! For W3C-DOM, the iframe is never entered into the frames array, so the "parent.frame_A.iFrameName.location.href" syntax will not work.

By switching to "parent.frame_A.document.getElementById('iFrameName').src", it works fine. :)

Thx,

plectrum
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top