Skip to content

Instantly share code, notes, and snippets.

@Alacrity01
Last active June 7, 2019 15:32
Show Gist options
  • Save Alacrity01/2f1bf0af6922a96b7ea8eb719cca0e52 to your computer and use it in GitHub Desktop.
Save Alacrity01/2f1bf0af6922a96b7ea8eb719cca0e52 to your computer and use it in GitHub Desktop.
Week 7, Day 5
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment