« The AKC position on spay/neuter: legislation bad | Main | Best grocery store: Trader Joe's »

June 22, 2008

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a015392891771970b0162fbe4bd22970d

Listed below are links to weblogs that reference Stupid anchor tag hack:

Comments

Feed You can follow this conversation by subscribing to the comment feed for this post.

Arthur Klepchukov

This isn't great from an accessibility perspective but a nice tip nonetheless!

Chris

This is kind of old, so I'm not sure if you've figured it out, but it's really not that hard.

When setting the javascript event to the link (whatever href) just end it with return false;.

This just means the link won't go to the actual href, meaning it won't scroll anywhere and won't change the url in the address bar.

Dave Cortright

Thanks, Chris. Yeah I figured that trick out after this post. Of course for those browsers that don't support JavaScript or have it turned off, it's good to have a fall back. I've taken to doing both.

Michael

I have found that you can simply leave out the href part completely. at least with IE7 and Firefox3. I haven't tested on older browsers.

example:
text

Anybody know if this is a problem and I'm just not seeing it?

gaps

just make it
href="javascript:myfunction(myargs)"
and you won't even need the onClick property ;)

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment