Click to See Complete Forum and Search --> : JavaScript in frames


Bobby Peru
02-03-2003, 01:33 PM
could somebody explain me how to make this "combined menu" script work so that it opens links in another frame:

http://javascript.internet.com/navigation/combined-menu.html

I tried setting a target frame in form properties (using frontpage) and it added some code in html... the links still open in the same window though!

I've been trying to work around this for a couple of hours... I hope somebody will spare me of another 4 hours of troubleshooting!

thanks

pyro
02-03-2003, 01:56 PM
Instead of this

window.location.href = url;

do this

top.framename.location.href = url;

Bobby Peru
02-03-2003, 02:33 PM
Ok, I tried what you posted, Pyro.

It prompts a script error which says:

"top.framename.location is not an object"

I'm pretty new to this so I hope you'll all bear with me

Webskater
02-03-2003, 03:10 PM
"top.framename.location is not an object"

Where it says "framname" in the phrase above, you are supposed to put the name of the frame you are targetting. Framename is supposed to be a generic expression in this instance that means "put whatever your frame is named here".

pyro
02-03-2003, 03:11 PM
top.framename.location.href needs to be top.thenameofyourframe.location.href, where thenameofyourframe is the name you gave your frame in your frameset.

Bobby Peru
02-03-2003, 03:16 PM
heheh... I'm a bit slow this evening

But it works like a charm now...

thanks for the (incredibly fast) help guys!