You are on page 1of 1

dojo.ready Readiness, as it relates to an HTML page and the browser, can be a slippery mome nt to pin down.

We need both the DOM to be ready for manipulation, and Dojo (and any indicated dependencies more on that in a minute) to be loaded before any of our JavaScript code runs. Because ready has different meanings in different bro wsers, Dojo provides a reliable, cross-browser function for the purpose: dojo.re ady. We pass it a function, and that function gets executed at the ready moment. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Tutorial: Hello Dojo!</title> <!-- load Dojo --> <script src="http://ajax.googleapis.com/ajax/libs/dojo/1.6.0/dojo/dojo.xd.js "></script> <script> dojo.ready(function(){ alert("Dojo version " + dojo.version + " is loaded"); }); </script> </head> <body> <h1 id="greeting">Hello</h1> </body> </html>

You might also like