SyntaxFix
Write A Post
Hire A Developer
Questions
If you write it like
myButton.onclick = function() { alert(myMessage); };
It will work, but I don't know if that answers your questions.