You may find that your code is more convenient to maintain if you keep all your styles, etc. in CSS and just set / remove class names in JavaScript.
Your CSS will obviously be something like:
.highlight { background:#ff00aa; }
Then in JavaScript:
element.className = element.className === 'highlight' ? '' : 'highlight';
Ian Oxley Aug 19 '08 at 11:59 2008-08-19 11:59
source share