And *IF* you followed Felgall's suggestion for writing modern JavaScript, it is all a non-issue.
You could write the page thus:
Code:
<html>
<body>
<div id="mainContent"> ... </div>
<script type="text/javascript">
(
function( )
{
document.getElementById("mainContent").onclick =
function()
{
this.className = ( this.className == "example") ? "" : "example";
}
} /* end of anonymous master function */
)( ); /* self-invoke master function */
</script>
</body>
</html>
Notice that I also rewrote the onclick to be much simpler/more efficient. It could have been written that way in tho original.