CodeSOD: Ordering Off This Menu

This post was originally published on this site

The Daily WTF

While browsing one day, Emma clicked a link on a site and nothing happened. That was annoying, but Emma wasn’t about to give up. She tried to get the URL out of the link, only to discover that there wasn’t a URL. Or a link. A quick trip to the DOM inspector highlighted what was going on:

<div id=”I32″ align=”left” onclick=”ItemClick(3,2)” onmouseout=”RollOut(3,2,false)” onmouseover=”RollOver(3,2,false)” style=”position: absolute; top: 43px; left: 1px; width: 176px; height: 16px; font: bold 8pt Arial; color: rgb(1, 35, 69); background: none repeat scroll 0% 0% rgb(255, 255, 255); padding: 2px; cursor: pointer; border: 0px solid rgb(255, 255, 255);”>Project Office</div>

This is an anti-pattern I thought had died circa 2006. Don’t reinvent hyperlinks in JavaScript. Here, we have a div with an onclick that triggers navigation- assuming the code works, which it didn’t in this case. But this isn’t the WTF, it’s just the appetizer.

Emma wasn’t about

To read the full article click on the 'post' link at the top.