<script>
function toggleClass(el, class1, class2) {
el.className = (el.className == class1) ? class2 : class1;
}</script>
<style>
span {padding: 2px 10px;}
.odd {background-color: #cd853f;}
.even {background-color: #8fbc8f;}
</style>
<span class="odd" onclick="toggleClass(this, 'odd', 'even')">Span</span>
|