forked from bethrobson/Head-First-JavaScript-Programming
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmap.html
More file actions
25 lines (24 loc) · 565 Bytes
/
map.html
File metadata and controls
25 lines (24 loc) · 565 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Pirates Booty</title>
<script>
window.onload = init;
function init() {
var map = document.getElementById("map");
map.onmousemove = showCoords;
}
function showCoords(eventObj) {
var coords = document.getElementById("coords");
var x = eventObj.clientX;
var y = eventObj.clientY;
coords.innerHTML = "Map coordinates: " + x + ", " + y;
}
</script>
</head>
<body>
<img id="map" src="map.jpg">
<p id="coords">Move mouse over map to find coordinates...</p>
</body>
</html>