About dojo What is not described here, you can find it on Google.
Here is to build it as fast as possible The first hello world program.
1. Download the toolkit
2, import into the Web project< /span>
- —WebRoot
- ——dojo
- ———dojo
- ———dijit
- ———dojox
3. Test whether the installation is successful: http://localhost:8080 / DojoTest /dojo/dijit/themes/themeTester.html
Server: http://localhost:8080
Project name: DojoTest
Can be accessed normally, which means the deployment is successful.
4. An example
-
-
< wbr> -
test -
< wbr> -
-
-
class=“tundra” >< wbr> -
UserName: -
“text”type= length= “20”id= “myname” < /li> -
dojoType= li> -
-
PassWord: -
“password”< wbr>length=“20”type= id= “mypassword” -
“dijit.form.TextBox”>wbr>dojoType= -
span> - id=“mybutton”
dojotype= “dijit.form.Button”>< wbr> Submit -
span> -
< li style="margin:0px 0px 0px 30px; padding:0px; border:0px; list-style:decimal">
- djConfig=“parseOnLoad:
true”
< span style="color:rgb(64,64,64); font-family:simsun; font-size:14px; line-height:21px; background-color:rgb(214,200,251)"> means that after the page is loaded, The Dojo-enabled parsing module will check the Dojo tag attributes in the page (Dojo tag attributes refer to some tags defined by Dojo). Remember, these tags can only be parsed for browser recognition and execution after being processed. djConfig is a global configuration parameter for using Dojo pages. By assigning different values to this parameter, you can control whether the Dojo parsing module in the page is running, whether the Dojo debugging module is working, and so on.
- @import
“dojo_path/dijit/themes/tundra/tundra.css” span>
indicates the introduction of Dojo tundra style cascading style sheets.
- dojo.require(“dojo.parser”)
represents the introduction of Dijit’s analytical function module. This module will replace the Dojo tag attributes with tags that the browser can recognize and execute. What needs to be different from djConfig=”parseOnLoad:true” is that djConfig=”parseOnLoad:true” means that the parsing function will be executed after the page is loaded, but the introduction of the parsing function module depends on dojo.require(“dojo.parser”) to realise.
- dojo.require(“dijit.form.TextBox”)
-
dojo.require( “dijit.form.Button”)
表示引入 Dojo 风格的文本输入框和按钮的功能模块。
- dojo.connect(dijit.byId(“mybutton”).domNode,
“onclick”, “login”)
表示将按钮的点击事件和 login 函数联系起来,当点击 id 为 mybutton 的按钮时,执行 login 函数。
- dijit.byId(“myname”).setValue(“”)
表示调用 id 为 myname 的 Dojo 文本框的 setValue 函数,将文本框里面的内容清为空。
- type=“text”
length= “20”id= “myname”dojoType= “dijit.form.TextBox”>
中的 dojoType=”dijit.form.TextBox” 表示在页面中文本输入框是 Dojo 风格的。需要注意的是,通过声明 dojoType=”dijit.form.TextBox” 这种方式来实现某些 Dojo 功能的使用,其表现形式上如同声明一个 HTML 标签的属性(如同 width=”10px”),因此在本文中称其为 Dojo 标签属性。在页面加载完成以后,Dojo 的解析模块会将 Dojo 标签属性转化为浏览器能够识别执行的标记。
5、运行测试。
-
-
-
test -
-
-
-
-
-
UserName: -
type= length= “20”id= “myname” -
dojoType= -
-
PassWord: -
type= length= “20”id= “mypassword” -
dojoType= -
- id=“mybutton”
dojotype= “dijit.form.Button”>Submit -
-
Java代码
- djConfig=“parseOnLoad:
true”
Java代码
- @import
“dojo_path/dijit/themes/tundra/tundra.css”
Java代码
- dojo.req uire(“dojo.parser”)
Java代码
- dojo.require(“dijit.form.TextBox”)
-
dojo.require( “dijit.form.Button”)
Java代码
- dojo.connect(dijit.byId(“mybutton”).domNode,
“onclick”, “login” )
Java代码
- dijit.byId(“myname”).setValue(“”)
Java代码
- type=“text”
length= “20”id= “myname”dojoType= “dijit.form.TextBox”>
Java代码