Tryit Editor v2.3

Edit This Code:
<!DOCTYPE html> <html> <body> <p>This example demonstrates how to assign an "onclick" event to the window object.</p> <p>Click anywhere in this window to change the background color of body.</p> <script> window.onclick = myFunction; function myFunction() { document.getElementsByTagName("BODY")[0].style.backgroundColor = "yellow"; } </script> </body> <!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_onclick_win by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 23 Jan 2015 08:29:15 GMT --> </html>
Result:
Try it Yourself - © w3schools.com