<div dojoType="dijit.Dialog" id="dialog1" closeNode="hider" title="填寫表單">
<form onsubmit="return false;">
<table>
<tr>
<td><label for="name">姓名: </label></td>
<td><input type="text" id="name"></td>
</tr>
<tr>
<td><label for="loc">性別: </label></td>
<td><input type="text" id="loc"></td>
</tr>
<tr>
<td><label for="desc">年齡: </label></td>
<td><input type="text" id="desc"></td>
</tr>
<tr>
<td><label for="fileloc">電子郵件: </label></td>
<td><input type="file" id="fileloc"></td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="button" id="hider" value="填好了"></td>
</tr>
</table>
</form>
</div><br>
<br>
<select><option>看看對話框能不能擋住這個東西</option></select><br>
<br>
遮罩的顏色能夠經過設置.dijitDialogUnderlay來控制
</body>
</html>javascript
經過編程方式的一個對話框:
<html>
<head>
<title>Dialog</title>
<style type="text/css">
@import "../js/dojo/resources/dojo.css";
@import "../js/dijit/themes/tundra/tundra.css";
</style>
<script type="text/javascript"
djConfig="parseOnLoad: true, isDebug: true"
src="../js/dojo/dojo.js"></script>
<script type="text/javascript">
dojo.require("dijit.Dialog");
function showDia(cont){
var pane=dojo.byId("Dpane");
if(!pane){
pane=document.createElement("DIV");
pane.setAttribute("id","Dpane");
pane.style.width = "300px";
document.body.appendChild(pane);
}
pane.innerHTML=cont;
var dia=new dijit.Dialog({title:"dojo對話框"},pane);
dia.show();
}
var alert=showDia;
</script>
<style>
.dijitDialogUnderlay {
background: #666666;
opacity: 0.5;
}
</style>
</head>
<body class="tundra">
<button id="b1" onclick="alert('測試編程方式')">顯示dojo對話框</button> <br>css
<br>
<select><option>看看對話框能不能擋住這個東西</option></select><br>
<br>
遮罩的顏色能夠經過設置.dijitDialogUnderlay來控制html
</body>
</html>java
提示對話框的例子:
<html>
<head>
<title>Dialog</title>
<style type="text/css">
@import "../js/dojo/resources/dojo.css";
@import "../js/dijit/themes/tundra/tundra.css";
</style>
<script type="text/javascript"
djConfig="parseOnLoad: true, isDebug: true"
src="../js/dojo/dojo.js"></script>
<script type="text/javascript">
dojo.require("dijit.Dialog");
dojo.require("dijit.form.Button");
</script>
</head>
<body class="tundra">
<div dojoType="dijit.form.DropDownButton">
<span>顯示登陸表單</span>
<div dojoType="dijit.TooltipDialog" id="tooltipDlg" title="登陸信息" closeNode="hider2">
<form onsubmit="return false;">
<table>
<tr>
<td><label for="user">用戶名:</label></td>
<td><input type="text" id="user"></td>
</tr>
<tr>
<td><label for="pwd">密 碼:</label></td>
<td><input type="password" id="pwd"></td>
</tr>
<tr>
<td colspan="2" align="center">
<button id="hider2">登 錄</button>
</tr>
</table>
</form>
</div>
</div>
<br>
<select><option>看看對話框能不能擋住這個東西</option></select><br>
<br>
這個彈出式的對話框使用DropDownButton來實現比較方便,若是想要經過其餘方式實現可能須要一些dojo的編程。<br>
其實也能夠使用dijit.MasterTooltip來實現相似的功能。<br>編程
</body>
</html>
demo的加載速度可能比較慢,請耐心等待。demo地址:
http://www.dojocn.cn/dojo/demo/13_testDialog2.htm
http://www.dojocn.cn/dojo/demo/13_testDialog1.htm
http://www.dojocn.cn/dojo/demo/13_testDialog.htmapp