<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