what on earth is wrong with this? http://jsfiddle.net/sVT54/
<button onclick="myFunction()">Click me</button>
<p id="demo"></p>
    function myFunction()
{
document.getElementById("demo").innerHTML="Hello World";
}
what on earth is wrong with this? http://jsfiddle.net/sVT54/
<button onclick="myFunction()">Click me</button>
<p id="demo"></p>
    function myFunction()
{
document.getElementById("demo").innerHTML="Hello World";
}
 
    
    JSFiddle wraps your javascript code in the onLoad call of the page by default so myFunction is defined only in that function's scope. Change to No wrap - in <head> and your code will run as expected.

 
    
    include your JavaScript in
<Script>
 function myFunction()
 {
    document.getElementById("demo").innerHTML="Hello World";
 }
</script>
