Dojo Dialog Simple Example Code
<html> <head> <link rel="stylesheet" href="dojo-release-1.9.1/dijit/themes/claro/claro.css"> <script src='dojo-release-1.9.1/dojo/dojo.js'></script> <script type=text/javascript> require(["dijit/Dialog", "dojo/domReady!"], function(Dialog){ myDialog = new Dialog({ title: "My Dialog", content: "Test content.", style: "width: 300px" }); }); </script> </head> <body class="claro"> <button onclick="myDialog.show();">show</button> </body> </html> |
Table 5 Dojo Dialog Code
Code 설명
require 문에서 Dojo 위젯 Dialog를 호출하여 보여주는 예제이다. require로 Dialog를 호출하였으면 function에서 parameter로 받아야하며 parameter이름은 위젯이름과 굳이 똑같이 할 필요는 없다. 다만 주의할 점은 require문에서 호출한 위젯의 순서에 따라 function의 parameter에 매칭이 되는 점은 기억해야 한다. domReady!는 parameter를 필요로 하지 않는다.
결과 화면
Figure 3 Table5 결과 화면
'Dojo > Basic' 카테고리의 다른 글
Dojo Themes & dojo.js (0) | 2013.08.08 |
---|---|
옛날 Dojo 방식과 현대 Dojo 방식 (0) | 2013.08.08 |
Dojo Toolkit Install (0) | 2013.08.08 |
Dojo Reference Site (0) | 2013.08.08 |