Every so often you pick up a project that has been coded by somebody else and encounter something and you can’t help but wonder what the f**k they were thinking, often it’s down to naivety or a lack of knowledge, or even a use of old outdated coding methods but then sometimes it’s just mind boggling bizarre.
Here’s a few examples I’ve come across recently but I’m sure there’s plenty of you with more to share.
Using forms as links
<form action="link" method="post">
<input type="submit" value="link text">
This is a weird one I’ve encounted where a form is used as a link to another page, it’s not passing any post variables or anything it is just has the page set as the target and a submit button. All the function of a link, in a form! I can only assume the developer wanted to have browser styled buttons instead of text links?
Using the class “header”
This one really bugs me but I’ve often seen <p class=”mainHeader”></p>, this is what a heading tags are for!
In line styling
Ok more of a legacy thing, it used to be acceptable until people realised that it was much better to code semantically and keep your content and styling seperate. But it gets me nearly every time when I’m debugging trying to work out why a style won’t change something, after lots of messing round I eventually notice the style= in the element.
Not using lists
This I guess is just a personal bug bear but if you have a list of things, stick them in a bloody list! You don’t have to do it for everything, for instance menu items as lists I guess are more of a personal preference (although it could be argued otherwise!)
Again this is a legacy thing but I’m amazed that people are still turning out design in tables there is quite simply no excuse for it!
I’ve seen some strange things done with JavaScipt but this is a gem, http://www.kingstriangle.com/ tweeted by @rachelandew, all seems normal when you visit the site, but just view source on those top menu items. You will get the quite mind boggling coding of this.
<div id="nNews" onclick="document.location.href='news.php'">News</div>
It looks like a link and it works like a link but it is the strangest implementation ever, surely as a developer somebody would be familiar with an <a> tag?
If I encounter more I will add to the list but please feel free to contribute in the comments.
I love going through code and seeing endless amounts of BR tags to separate content, and by love, i mean hate a lot.