I made this short fiddle: http://jsfiddle.net/NZnN2/. Why is it not popping up the alert when I click the button?
Because your JavaScript code is in an onload handler, which means display_message is not global, and therefore not accessible by the HTML.
Since you selected onLoad, your JavaScript is injected into the page like this:
window.addEvent('load', function() {
    function display_message(){
        alert("woohoo!");
    }
});
As you can see, display_message is only accessible inside that anonymous function.  To make the example work, change onLoad to no wrap (head) or no wrap (body) (on the left side of the page).
Working example: http://jsfiddle.net/NZnN2/8/
instead of
function display_message() {
    alert('woohoo!');
}
do
display_message = function () {
    alert('woohoo!');
}
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With