Hey there, this site is pretty old now. I've decided to leave it up as I put a lot of work into it and would hate to see it disappear.

Add Tags

  Add Tags >>
 

Tag Recap

First Name:
Last Name:
Message:

Occasionally web developers like their links to pop-up in a new window. Often times this is because they are linking to a non-web file type or are linking to an external web site.

The easiest way to accomplish this is to place the target="_blank" attribute on an anchor. Unfortunately if you validate your code with the W3C you will find that it is not valid to use that practice. Do not fear, there is a solution!

The workaround err, solution, is to place an onclick on the anchor tag. The code below will open a new window, get the value in the href attribute and cancel the action the href attribute would take.

<a href="http://www.nealgrosskopf.com" onclick="window.open(this.href);return false;">Link</a>
Date:2008-01-28
Time:19:56:01
Replies:9
Views:9704