I believe you have already used JavaScript (JS) and have knowledge on the following topics in JS.
- Operators (Arithmetic, Assignment, Comparison, Logical, Conditional)
- Conditional Statements, Switch
- Functions
- For Loop, while, for…in,
- Events
If you are new to these, need not to worry. Refer this site for quick learning on JS.
Ok. Let us start using dojo right now. It is simple like how we include an external .js file in a web page. We need to include the dojo base file, dojo.js. There are two sources from where the dojo.js can be included in a page.
- Download the dojo toolkit from this url: http://dojotoolkit.org/download/. Save it and extract it in the project folder.
- Use the Content Delivery Network (CDN) source from google or aol.
<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.6.0/dojo/dojo.xd.js" type="text/javascript"></script>
Let us start with CDN source for easy to work purpose. I don't want to make you to spend time to download and get confused at this point of time. Surely lets take that after few lessons. Now start dojo and be happy that it is working in your machine.
Code: example-1.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Tech Prem - Dojo Lesson-1</title>
<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.6.0/dojo/dojo.xd.js" type="text/javascript"></script>
<script type="text/javascript">
dojo.ready(function()
{
alert("Success");
});
</script>
</head>
<body>
<p>If you have included the base dojo.js successfully, you should get an alert!</p>
</body>
</html>
No comments:
Post a Comment
Please post your comments to help you and others better.