Run ❯
Get your
own
website
Result Size:
625 x 565
❯
Run Code
Ctrl+Alt+R
Save Code
Ctrl+Alt+A
Change Orientation
Ctrl+Alt+O
Change Theme
Ctrl+Alt+D
Go to Spaces
Ctrl+Alt+P
<!DOCTYPE html> <html> <body> <h1>The Window Object</h1> <h2>The addEventListener() Method</h2> <p>This example adds many events on the window.</p> <p id="demo"></p> <script> window.addEventListener("mouseover", myFunction); window.addEventListener("click", mySecondFunction); window.addEventListener("mouseout", myThirdFunction); function myFunction() { document.getElementById("demo").innerHTML += "Moused over! " } function mySecondFunction() { document.getElementById("demo").innerHTML += "Clicked! " } function myThirdFunction() { document.getElementById("demo").innerHTML += "Moused out! " } </script> </body> </html>