Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dom - document object model
- <!DOCTYPE html>
- <html lang="en">
- <head onmousemove="doAnotherThing()">
- <meta charset="UTF-8">
- <title>Hamilton</title>
- </head>
- <body onmousemove="doAnotherThing()">
- <h1 onmouseover="doTheThing()">Alexander Hamilton</h1>
- <p onmousemove="doAnotherThing()">Here is the story of the life of Hamilton.</p>
- <p onmouseover="doAnotherThing()">
- <script>
- console.log(doTheThing());
- </script>
- </p>
- <script>
- function doSomething() {
- console.log("You clicked me!");
- }
- function doAnotherThing() {
- console.log("You touched the p tag... :D");
- var x = event.clientX;
- var y = event.clientY;
- console.log("X coordinate: ", x);
- console.log("Y coordinate: ", y);
- }
- function doTheThing() {
- console.log("Oh no! You touched the H1 tag...!");
- var x = event.clientX;
- var y = event.clientY;
- console.log("X coordinate: ", x);
- console.log("Y coordinate: ", y);
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement