Using the Target Attribute

By Alan Coleman on Jun 11, 2007


At times you may need to launch certain links into a new window. The ‘target’ attribute is deprecated and is therefore not allowed when using XHTML with a strict doctype. Using this script, you will be able to keep your pages valid while also using the target attribute to open new windows.


Source Code

Paste this source code into the designated areas.

External file

Paste this code into an external JavaScript file named: targetAttribute.js


Paste this code into the HEAD section of your HTML document.


Paste this code into the BODY section of your HTML document