addLoadEvents.html
1.51 KB
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Testing dojo.addOnLoad(), dojo.addOnUnload() and dojo.addOnWindowUnload()</title>
<script type="text/javascript"
src="../../../dojo.js" djConfig="isDebug: true"></script>
<script type="text/javascript">
dojo.addOnLoad(function(){
console.debug("addOnLoad(func) works");
});
var scope = {
named: function(){ console.debug("addOnLoad(obj, name) works"); },
refd: function(){ console.debug("addOnLoad(obj, func) works"); }
};
dojo.ready(scope, "named");
dojo.addOnLoad(scope, scope.refd);
// dojo.addOnLoad(scope, "named");
// dojo.addOnLoad(scope, scope.refd);
dojo.addOnWindowUnload(function(){
alert("addOnWindowUnload works");
});
dojo.addOnUnload(function(){
alert("addOnUnload works");
});
</script>
</head>
<body>
<h1>Testing dojo.addOnLoad(), dojo.addOnUnload() and dojo.addOnWindowUnload()</h1>
<p>This page has registers a function with dojo.addOnLoad(), dojo.addOnUnload() and dojo.addOnWindowUnload.</p>
<p><b>dojo.addOnLoad()</b>: You should see 3 console messages about addOnLoad working.</p>
<p><b>dojo.addOnUnload()</b>: You should see an alert if the page is reloaded, or if you navigate to a
different web page ("addOnUnload works").</p>
<p><b>dojo.addOnWindowUnload()</b>: You should see an alert if the page is reloaded, or if you navigate to a
different web page ("addOnWindowUnload works").</p>
</body>
</html>