Worst code you’ve ever seen?
Once every now and then you come across code that is so ghastly, so terrible, that it almost makes you go blind! While fighting the pain, you (think) you can be almost sure of one thing: this must have been done on purpose!
Yesterday was one of these moments for me. I came across a web page, consisting of these parts, which I’ll try to describe below (without getting sick):
A sample of HTML errors
- Two complete HTML documents, meaning that first one document started, from
<html>to</html>, containing one part of the web page. That was then closed, and a new<html>element started the section containing some other parts. - The funkiest “double-closing” of a
spantag I’ve ever seen:<span id="someKindOfIdThatICantDisplay" /></span>. - A complete mix of lower- and uppercase tags, in a table-based layout (yeah, what did you think?).
Some JavaScript weirdies
- It had a nice
onloadevent (naturally, applied directly to thebodytag…), which changed the actual name of a hidden field in a form, during certain circumstances (instead of, I don’t know, changing its value?!). - A nice code branch trying to ensure Netscape 4 compatibility with
document.layers. Guys, let me tell you: I’ve spent my fair share of pain-filled years making sure that things worked in Netscape 4. And what I remember is that Netscape 4 would, for no apparent reason, just crash in your face if it missed any single tag. With your “two-documents-in-one”-approach, there’s no way your script would even get the chance to run in that web browser. - A
<BR>tag in one of the comments in thescriptblock, like this: // This is for Netscape<BR>.
I guess by now you’re wondering who’s behind this. I can’t disclose that, but I can give you one code line as a hint to what technology they’re used to:
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
Think you’ve seen worse? I dare you!


