View Full Version : document.location with frames
Hi.
I'm trying to write a script in a frameset that relocates the main frame to blah.html, and the left frame to side.html. This is in an external script and is being called by by a form...onsubmit.
document.main.location = "blah.html"
document.left.location = "side.html"
The main frame is named main and side frame is left. Help would be greatly appreciated.
Skyzyx
04-18-2003, 06:40 AM
I believe this works:
parent.frames["main"].document.location.href="blah.html";
parent.frames["left"].document.location.href="side.html";
joh6nn
04-18-2003, 08:55 AM
also, this is worth reading: http://www.faqts.com/knowledge_base/view.phtml/aid/6702
Thanks for the link, but the script doesn't work for me.
All I have is three frames: Two rows and in the second row there is the side frame and the main frame. names:
Top: id="top" name="top"
Left: id="side" name="side"
Main iid="main" name="main"
The only things I changed in the script were the typo in document and the left to side. However, it comes up with the error:
Line: 4
Char: 1
Error: parent.frames.side is null or not an object.
here's the code:
auth = true;
parent.frames["main"].document.location.href = "success.html";
parent.frames["side"].document.location.href = "side.html";
parent.frames["top"].document.location.href = "head.html";
For some reason, its picking up the third line (frame["side"]) as the fourth as it says in the error.
Oh yea, by the way, the link is coming from the main frame...I don't know if that would make a difference though.
whammy
04-18-2003, 10:47 PM
So try just using the frames heirarchy instead, maybe there's an error in your naming convention... like
document.frames[0]
document.frames[1]
etc...
since this stuff is treated as an array by the DOM
And how exactly would I use that? This is the first time I've used frames in absolute ages, and the first time I'm using js with it.
whammy
04-18-2003, 11:14 PM
google it - if you're using frames, you MUST understand this... otherwise, you shouldn't use frames. ;)
Skyzyx
04-19-2003, 02:56 AM
Make sure that this is NOT called from the HEAD tag. In the HEAD tag, the frames have not yet been created. You can use BODY ONLOAD instead.
That may be the problem.
Actually, this is in an external js file.
However, I have it fixed now.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.