News for hackers. Stuff that matters.
Re:JavaScript Programming Patterns by jerf on Tuesday October 06, 2009 @02:22PM (#864835)
Hmm, that "old way" is wrong. The way it would have been done in 1998 is something like

   <li>
      <a href="..." onclick="this.style.backgroundColor='#FF6633'">BBC</a>
      <a href="..." onclick="this.style.backgroundColor='#CCCC00'>NYT</a>
and so on. With no further Javascript needed. Except I wouldn't have trusted "style", and the browsers without styles probably wouldn't have been able to change background colors for links at all, but that's obviously not the point here.

...

To be honest, this is probably how I'd do it today, too. The natural objection about it being not "semantic" or whatever is something I'd fix in the generation code, where it would be perfectly "semantic". There isn't a single one of those techniques that isn't an amazing pile of code to accomplish something very simple. Yeah, I understand this is for didactic purposes, but I'm finding it hard to see past this point. YMMV.

There are no comments on this comment yet.