Since your JavaScript code is in the onload handler, which means that display_message not global and therefore HTML is not available.
Since you selected onload , your JavaScript is injected into the page as follows:
window.addEvent('load', function() { function display_message(){ alert("woohoo!"); } });
As you can see, display_message is only available inside this anonymous function. To make a working example, change onload to no wrap (head) or no wrap (body) (on the left side of the page).
Working example: http://jsfiddle.net/NZnN2/8/
Rocket hazmat
source share