Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.



Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: