FF1+ IE5+ Opr7+
Open select links in new window
Description: This one of a kind script makes it easy to specify certain links on your page open in a new window, and with greater control than HTML's "target" attribute. You can designate arbitrary links- or even entire groups of links- open in a new window by doing one of the following:
1) Give the
link a class="nwindow" attribute.
And to make it all worthwhile, this script supports two modes of operation- automatic or manual. In the former, the designated links (by doing one of the above steps) will automatically open in a new window. In "manual" mode however, visitors use a checkbox to toggle between the designated links opening in a new window or current instead. Control and versatility is what this script is all about!
Demo: (mode 2 "manual" shown)
Simply add the following script to the <BODY> section of your page, at the very end following all links on the page:
As noted, the script lets you designate links to open in a new window using two ways:
1) Give the link a special class:
<a href="http://www.dynamicdrive.com" class="nwindow">Dynamic Drive</a>
2) Wrap groups of links in a container with a special class:
<div class="nwindowcontainer"> link 1 link 2 etc </div>
Furthermore, you have the option of letting the visitor decide whether these links should open in a new window, by adding a checkbox to your page:
<form name="targetmain"><input type="checkbox" name="targetnew" checked onClick="applywindow(targetlinks)">Open designated links in new window</form>
The mere presence of this checkbox will cause the script to switch to "manual" mode.