E chi ha parlato di jquery...avevo detto prototype.

In ogni caso, basta sostituire il $ con document.getElementById