Easily Create External Links Without the Target Attribute

Today's tip is extremely short and simple, and to a lot of folks may be a "Duh!" sort of tip, but I felt it was worth sharing.

I'm a big fan of keeping sites valid in XHTML 1.0 Strict. When I first started paying attention to standards, one of the things that stumped me right off the bat was the use of external links.

The Problem with target="_blank"

As I'm sure most people know, the use of the target attribute isn't considered valid. However, in order to open links in a new page, the only tool provided by HTML is the target attribute!

I had been creating external links for as long as I could remember using the following format:

<a href="http://example.com" target="_blank">External link</a> The Fix: rel="external"

The HTML When... read more

Beautiful Forms with JavaScript

A while back, I posted a blog called "The JavaScript Switcharoo" that presented a technique for eliminating labels from form inputs. It was pointed out in the comments that this technique not only threw errors in Internet Explorer (not good), but would also cause usability issues for screen readers and other text-only browsers (also not good). I've since rewritten the script to cooperate in the ever-troublesome IE family of browsers, as well as using accessible XHTML markup.

View the Demo | Download the Source Code

What are we going for, here?

The desired outcome of this script is to 1) create a standard comment form, 2) dynamically display form field descriptions inside each form field using the information stored in corresponding label elements, then write functions to 3) hide the description when the user... read more

The JavaScript Switcharoo

NOTE: As noted in the comments, there are some usability issues with this script. An updated version is available here.

I hate form labels.

There. I said it.

I'm opposed to the idea of forcing a little snippet of text to line up next to each form element so that we know what's going on with it. It's difficult, it takes up extra space, and it tends to make something like a newsletter input eat up too much screen real estate.

However, it would be rude of me to just assume that everyone knows what the hell I'm asking for when I slap a couple inputs in the top right of a site.

To get around this issue, I wrote a quick JavaScript function to make... read more

  • «
  • 1
  • »