JAVASCRIPT ONCLICK EXAMPLE
Run
<html>
    <head>   
        <title>JavaScript onClick Example</title>
        <script>
            // event handler function
            function doSomething() 
            {
                alert("Event triggered");
            }
        </script>      
    </head>
    <body>   
        <p>This button has an Event Handler...</p>
        <!-- onClick attribute in HTML -->
        <button id="btn" onClick="doSomething()">Do Something!</button>
    </body>
</html>