HTML
<div id="test"></div>
<input type="button" value="Go" onclick="test()" />
JavaScript
function test() {
    alert("Test!");
}
Fiddle
HTML
<div id="test"></div>
<input type="button" value="Go" onclick="test()" />
JavaScript
function test() {
    alert("Test!");
}
Fiddle
 
    
    Please look at this one, it is about jsfiddle code frames separation:
Inline event handler not working in JSFiddle
Of course, if you were running the same code embedded on plain HTML it works normally, having the alerted popup appearing.
<!DOCTYPE html>
  <html>
    <head>
      <script>
        function test() {
          alert("Test!");
        }
      </script>
     </head>
     <body>
       <div id="test"></div>
       <input type="button" value="Go" onclick="test()" />
     </body>
  </html>
 
    
     
    
    when you do
onclick="test()"
as an attribute of the input element, you are setting the result of the call test() (in your case 'null') as the click event handler
you probably want to do this
onclick="test"
instead, which will set the actual 'test' function as the handler,
or even better, follow the following guidelines: unbtrusive javascript or unobtrusive JS (2),.. you get the point ;)
 
    
    