So, an old
friend of mine (one of the
few people who actually reads this blog, methinks) dropped me an email to let
me know that my wonderful new standards-compliant navel-gazing website wasn't
as up-to-date as it should be: horror of horrors, I dared to use
| <blah onclick="javascript goodness">
|
all over the damn
place, giving everything that oh-so-1999 feel. Okay Ben, here you go; both
the sidebar hide/show functionality and the
resume
section expansion has been unceremoniously ripped from the HTML (along with
the plethora of
tags I had to sprinkle everywhere) and
replaced with a gaggle of JavaScript borrowed from several places and a bunch
of
DOM manipulation.
May I point out, however, that getting the "new DOM way" working was a huge
PITA? My first cut working with
Firefox worked like a
champ. Then I fired up
Internet
Explorer (why does firing up that web browser always mean I'm going to
have a late nigh?), and was greeted by...nothing. A big, fat blank screen.
WTF? I notice that if I comment out
the call to the external JavaScript file, the page displays properly. Hmm.
On a whim, I tried changing the reference from
to
| <script ...></script>
|
and viola, it
works. You have got to be kidding me.
Then, we get into the mess that is
vs.
vs.
. That took a
lot of straightening out; I eventually completely ditched the code that
Ben
originally
suggested from Scott Andrew, and ended up using Andy Smith's very nice
cross-browser
event addition handler, using anonymous functions so that
works like it bloody well should. (Microsoft, are you listening? Of course
you aren't, how silly of me. :-P). Andy's code has the additional benefit of
handling nested event handlers in a very slick manner.
Finally, I had a problem with Firefox "bouncing" back to the top of the
screen every time I'd click on one of my psuedo-links for expanding and
collapsing a section. Easily solved by calling
on the event object passed to the event handler, but once again, it's not
supported by IE events (nor did IE do what, in retrospect, appears to be
the right thing: fall through to the default event handler if mine doesn't
explicitly say not to). So, that's all fixed up, and I appear to have, once
again, a working cross-browser website (with substantially simpler HTML).
Isn't standards-compliance fun? ;-)
As a side note, there's still a bit more to do; rather than mangling
in my
expand/collapse
code, I should really just create a couple of objects that I can swap in
and out there instead. But that will come tomorrow.