Eurotunnel exploring the depths of illogical coding



The coding of this site contains a very basic mistake whoever wrote the site does again and again.. and again…

Some background: in HTML there are two ways you can identify some part of the page, say the box where you type the departure date: by name and by ID. The difference is that it is legal to give several bits of the page the same name (say, if you had two different forms for booking you could have a box named departure in each of them) but the ID must have a unique value for each element it is used for on the page.

JavaScript gives you two functions to work with specific elements: getElementById and getElementsByName. The former will let the script do something to the element that matches the given ID and the latter create a list of elements that match the given name.

So far so good. Now, incidentally Microsoft decided to extend getElementById a little and let it match NAMEs to under certain circumstances. Guess what – the Eurotunnel page uses lots of elements with a NAME and accesses them with the getElementById function. Consequently everything – absolutely everything – on the page is broken for any browser that isn't MSIE.

Bother. The specification is so nice and logical: getElementsByName finds something with a NAME. To find something with an ID you locate it with getElementById. Perhaps MS and Eurotunnel don't like things that make sense..


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s