Six months ago I whipped up a Flickr-in-CSS (Cascading Style Sheets) proof of concept page [1]. Since then, Flickr [2] has actually converted to using CSS and JavaScript where before they were using Flash and doing an incredible job. But when I saw Dan Lyke doing a variation on it [3], I decided to upgrade the “proof-of-concept.”
So, between answering support tickets and attempting to install Linux on a Cobalt RaQ4 [4] (don't ask—it's not pretty) I sat there hacking away at improving the page.
Unfortunately, if you are using IE (Internet Explorer), don't bother checking it. I gave up after spending way too much time trying to support both Mozilla (which supports the latest standard for [DELETED-JavaScript-DELETED] ECMAScript [5]) and IE (which is in a different ballpark altogether).
What I didn't want to do is:
>
```
if (document.getElementById)
{
popUpWinStyles = document.getElementById(id).style;
}
else
{
popUpWinStyles = eval('document.' + id);
}
```
everywhere (basically, if you support the standard document.getElementById() function, use it, otherwise use the Microsoft way. That adds just tons of if statements all over the code and tends to make debugging rather difficult.
I thought that maybe doing:
>
```
if (document.all) // are we Microsoft?
{
document.getElementById = function(id)
{
var obj = eval('document.' + id);
return(obj);
};
}
```
would work.
And it would have too, had it not been for those meddling programmers!
I mean, it worked as far as adding the getElementById() method to the document object if it's Microsoft, but what I forgot was that in the standard, to set the color of an element is:
>
```
obj.style.color = 'blue';
```
whereas under Microsoft it's:
>
```
obj.color = 'blue';
```
The standard has all the CSS attributes under obj.style where as Microsoft just sticks them under obj—one layer up, as it were.
Grrrr.
But then … even adding all the if statments (which I wanted to avoid in the first place) was problematic as IE's support of CSS is … maddening.
So, I decided it was easier to just forget about IE for this.
It's not like I use it.
[3] http://www.flutterby.com/archives/2005_Jun/28_ShaverToWishonBikeRide.html
[5] http://www.ecma-international.org/publications/standards/Ecma-262.htm