JavaScript: window.location inside a frame?


I have a page with a small frame on the top, and another on the bottom. I was wondering what code I would use to specify the URL of the bottom frame FROM the top?

IE: I have a JavaScript variable called “location”, which holds the URL I would like to load in the frame. The frame is called “main”.

I tried this like

location = window.frames.main.location


location = window.main.location

but nothing seems to work. Can someone help me out? :slight_smile:


this should do the job…


(When you’ve got a framed page, window refer to the current frame. If you want to refer to the main window you’ve got to use parent.As well if you want to interact with other frames you have to pass by the main window. It’s like a path to access frames within you pages).

<Edited by cyberbrain on 12-01-2000 at 05:10 PM>

Thanks cyberbrain - it was totally driving me nuts!

Can you possibly, in addition, point me to a tutorial on JavaScript’s DOM?

Unfortunately I don’t know any site specifically consacred to the DOM. (your best guess would be to visit the NS or IE website or some javascript tutorial site).