Java Reference
In-Depth Information
Example Code
To test the examples in this chapter, create a file called events.htm that contains the fol-
lowing HTML. This includes some paragraph elements that we'll attach event listeners to
throughout the chapter:
events.htm
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Events Examples</title>
<link rel="stylesheet" href="css/styles.css">
</head>
<body>
<p id="click">Click On Me</p>
<p id="dblclick">Double Click On Me</p>
<p id="mouse">Hover On Me</p>
<script src="js/scripts.js"></script>
</body>
</html>
We'll also need a bit of styling, so create a css folder with a file inside called styles.css con-
taining this code:
styles.css
p {
width: 200px;
height: 200px;
margin: 10px;
background-color: #ccc;
float: left;
}
.highlight{
Search WWH ::




Custom Search