-
Notifications
You must be signed in to change notification settings - Fork 0
/
L7.6.html
35 lines (31 loc) · 1002 Bytes
/
L7.6.html
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
26
27
28
29
30
31
32
33
34
35
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script>
function cascadeDown(evnt){
alert("Capturing: "+this);
}
function bubbleUp(evnt){
alert(("Bubbling: "+this))
}
window.onload = setup;
function setup(evnt){
document.addEventListener('click',cascadeDown,true);
document.forms[0].addEventListener('click',cascadeDown,true);
document.forms[0].elements[0].addEventListener('click',cascadeDown,true);
document.addEventListener('click',bubbleUp,false);
document.forms[0].addEventListener('click',bubbleUp,false);
document.forms[0].elements[0].addEventListener('click',bubbleUp,false);
}
</script>
</head>
<body>
<form style="background-color: #f00;width: 100px;height: 100px;padding: 10px" action="">
<p>
<input type="submit" value="Submit"><br/>
</p>
</form>
</body>
</html>