I am using JavaScript. I have a variable var boolVal that either evaluates to true/false. On my page, I have a div tag.
var boolVal
You should use:
boolVal.onchange=function(){ document.getElementById("MyElement").className = boolVal ? "redClass" : "blueClass"; };