PDA

View Full Version : How to open file in another target?


Nodde
12-12-2003, 04:08 PM
I´ve just started to work with javascripts and need a lot of hours before i´ll be rather good at it. Right now i need help with this:

How can i get the file company.html to open in the frame "huvud"?

<tr onMouseover="this.style.background = '#3C3C3C'" onMouseout="this.style.background = '#000000'" style="cursor:hand" onClick="document.location.href='company.html'">

adios
12-12-2003, 04:13 PM
onclick="top.huvud.location='company.html'">

...just a guess, since you left out your frameset structure.

Nodde
12-12-2003, 04:16 PM
Thank you very much!!!

It works. I´m so greatful to u! Have a nice weekend!

glenngv
12-13-2003, 03:04 PM
using:

onclick="window.open('company.html','huvud')"

is more flexible. In case the page is not opened in frames, the page will still be opened, of course not in frames, but in a new window that will be named 'huvud'. Using top.huvud will cause a javascript error if the frame 'huvud' does not exist.

adios
12-13-2003, 04:30 PM
Why not just use an anti-hijacking script? Not being able to directly reference a particular frame pretty much invalidates programming your frameset.

onclick="if(top.huvud)top.huvud.location='company.html'">

...would avoid the error. Doesn't solve the basic problem, though.

Nodde
12-13-2003, 04:48 PM
Once again, thank you guys!