Entry
(How) Can I make a layer a link target (NN4)?
(How) Can I make a layer a link target (NN4)?
Mar 11th, 2000 02:31
cemal kemal, Martin Honnen,
Positioned elements (layers) in NN4 allow an external url to be loaded
into them. Nevertheless using a layer's name as the target in a link
e.g.
<A TARGET="yourLayerName" HREF="http://javascript.faqts.com">
JavaScript.FAQts.com
</A>
does not work as desired as layers are not targettable thus above link
will not find the so named target and open a new window.
Also links inside a layer(positioned element) target the containing
window and NOT the layer itself so when you load a document into a
layer with some links (where no target is given) the links will load
into the window containing the layer.
JavaScript comes to help by setting the layer's src property in the
onclick handler of the link thus
<A HREF="http://javascript.faqts.com"
ONCLICK="window.document.yourLayerName.src = this.href;
return false;"
>
JavaScript.FAQts.com
</A>
produces a link which will load into the layer yourLayerName (when it
is a top level layer, check the knowledge base how to reference nested
layers).
It is hard to present cross browser code here as mainly IE4/5 and NN6
don't know the concept of external src for a layer/positioned element.
There are several ways around (hidden frames, IFRAMEs, OBJECTs) which
would require different scripting so I leave the link as it is stating
explicitly that it is NN4 only.