<div align="right" style="border:1 #FF0 solid; background-color:#999" onMouseOver="javascript: function(){this.style.backgroundColor = '#DDD';}" onMouseOut="javascript: function(){this.style.backgroundColor = '#999';}">
Register
</div>
When mouseover event triggered it gives this error:
Uncaught SyntaxError: Unexpected
token (
What should I do? I want to define a function inside onMouseOver and onMouseOut
Don’t use
functiondeclaration, just do:And:
By the way, you should consider unobstrusive javascript.