-
Notifications
You must be signed in to change notification settings - Fork 0
/
LoadListener-test.html
85 lines (79 loc) · 6.19 KB
/
LoadListener-test.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<html>
<head>
<script type="text/javascript" src="LoadListener.js"></script>
<script type="text/javascript">
var startDate = new Date();
window.onload = function() {
window.status += " --- All loaded: " + (new Date() - startDate) + "ms";
}
function handleLoad1() {
window.status += " --- Handler 1: " + (new Date() - startDate) + "ms";
//document.write("<b>[[[ Handler #1 has fired. ]]]</b>");
}
function handleLoad2() {
window.status += " --- Handler 2: " + (new Date() - startDate) + "ms";
//document.write("<b>[[[ Handler #2 has fired. ]]]</b>");
}
function handleLoad3() {
window.status += " --- Handler 3: " + (new Date() - startDate) + "ms";
//document.write("<b>[[[ Handler #3 has fired. ]]]</b>");
}
function handleLinkLoad() {
this.href = "success.html";
}
var myLoader = new LoadListener();
var loaderObj = myLoader.getElementById("theElement")
loaderObj.addHandler(handleLoad1);
loaderObj.addHandler(handleLoad2);
var loaderObj = myLoader.getElementById("theElement2")
loaderObj.addHandler(handleLoad3);
var loaderObj = myLoader.getElementById("theElement2")
loaderObj.addHandler(handleLoad3);
var loaderObj = myLoader.getElementsByTagName("a");
loaderObj.addHandler(handleLinkLoad);
</script>
</head>
<body>
<div id="theElement">This is the element.</div>
<div><a href="">filler</a> filler filler filler filler filler filler filler filler filler filler filler filler filler filler filler</div>
<div><a href="">filler</a> filler filler filler filler filler filler filler filler filler filler filler filler filler filler filler</div>
<div><a href="">filler</a> filler filler filler filler filler filler filler filler filler filler filler filler filler filler filler</div>
<div><a href="">filler</a> filler filler filler filler filler filler filler filler filler filler filler filler filler filler filler</div>
<div><a href="">filler</a> filler filler filler filler filler filler filler filler filler filler filler filler filler filler filler</div>
<div><a href="">filler</a> filler filler filler filler filler filler filler filler filler filler filler filler filler filler filler</div>
<div><a href="">filler</a> filler filler filler filler filler filler filler filler filler filler filler filler filler filler filler</div>
<div><a href="">filler</a> filler filler filler filler filler filler filler filler filler filler filler filler filler filler filler</div>
<div><a href="">filler</a> filler filler filler filler filler filler filler filler filler filler filler filler filler filler filler</div>
<div><a href="">filler</a> filler filler filler filler filler filler filler filler filler filler filler filler filler filler filler</div>
<div><a href="">filler</a> filler filler filler filler filler filler filler filler filler filler filler filler filler filler filler</div>
<div><a href="">filler</a> filler filler filler filler filler filler filler filler filler filler filler filler filler filler filler</div>
<div id="theElement2">This is another element.</div>
<div><a href="">filler</a> filler filler filler filler filler filler filler filler filler filler filler filler filler filler filler</div>
<div><a href="">filler</a> filler filler filler filler filler filler filler filler filler filler filler filler filler filler filler</div>
<div><a href="">filler</a> filler filler filler filler filler filler filler filler filler filler filler filler filler filler filler</div>
<div><a href="">filler</a> filler filler filler filler filler filler filler filler filler filler filler filler filler filler filler</div>
<div><a href="">filler</a> filler filler filler filler filler filler filler filler filler filler filler filler filler filler filler</div>
<div><a href="">filler</a> filler filler filler filler filler filler filler filler filler filler filler filler filler filler filler</div>
<div><a href="">filler</a> filler filler filler filler filler filler filler filler filler filler filler filler filler filler filler</div>
<div><a href="">filler</a> filler filler filler filler filler filler filler filler filler filler filler filler filler filler filler</div>
<div><a href="">filler</a> filler filler filler filler filler filler filler filler filler filler filler filler filler filler filler</div>
<div><a href="">filler</a> filler filler filler filler filler filler filler filler filler filler filler filler filler filler filler</div>
<div><a href="">filler</a> filler filler filler filler filler filler filler filler filler filler filler filler filler filler filler</div>
<div><a href="">filler</a> filler filler filler filler filler filler filler filler filler filler filler filler filler filler filler</div>
<div><a href="">filler</a> filler filler filler filler filler filler filler filler filler filler filler filler filler filler filler</div>
<div><a href="">filler</a> filler filler filler filler filler filler filler filler filler filler filler filler filler filler filler</div>
<div><a href="">filler</a> filler filler filler filler filler filler filler filler filler filler filler filler filler filler filler</div>
<div><a href="">filler</a> filler filler filler filler filler filler filler filler filler filler filler filler filler filler filler</div>
<div><a href="">filler</a> filler filler filler filler filler filler filler filler filler filler filler filler filler filler filler</div>
<div><a href="">filler</a> filler filler filler filler filler filler filler filler filler filler filler filler filler filler filler</div>
<div><a href="">filler</a> filler filler filler filler filler filler filler filler filler filler filler filler filler filler filler</div>
<div><a href="">filler</a> filler filler filler filler filler filler filler filler filler filler filler filler filler filler filler</div>
<div><a href="">filler</a> filler filler filler filler filler filler filler filler filler filler filler filler filler filler filler</div>
<div><a href="">filler</a> filler filler filler filler filler filler filler filler filler filler filler filler filler filler filler</div>
<div><a href="">filler</a> filler filler filler filler filler filler filler filler filler filler filler filler filler filler filler</div>
<img src="http://www.mozilla.org/images/mozilla-banner.gif">
<script>
window.status += " --- HTML loaded: " + (new Date() - startDate) + "ms";
</script>
</body>
</html>