惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Engineering at Meta
Engineering at Meta
博客园_首页
H
Help Net Security
WordPress大学
WordPress大学
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
罗磊的独立博客
博客园 - 三生石上(FineUI控件)
B
Blog
I
InfoQ
SecWiki News
SecWiki News
T
Tailwind CSS Blog
Spread Privacy
Spread Privacy
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
V
Vulnerabilities – Threatpost
N
Netflix TechBlog - Medium
P
Palo Alto Networks Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Vercel News
Vercel News
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
K
Kaspersky official blog
M
MIT News - Artificial intelligence
S
Schneier on Security
T
Threat Research - Cisco Blogs
F
Fortinet All Blogs
Cyberwarzone
Cyberwarzone
Scott Helme
Scott Helme
aimingoo的专栏
aimingoo的专栏
Martin Fowler
Martin Fowler
MyScale Blog
MyScale Blog
The Cloudflare Blog
Recent Announcements
Recent Announcements
Security Latest
Security Latest
G
GRAHAM CLULEY
IT之家
IT之家
Y
Y Combinator Blog
The Last Watchdog
The Last Watchdog
腾讯CDC
Google DeepMind News
Google DeepMind News
V
V2EX
S
Securelist
TaoSecurity Blog
TaoSecurity Blog
B
Blog RSS Feed
S
SegmentFault 最新的问题
博客园 - 叶小钗
P
Proofpoint News Feed
云风的 BLOG
云风的 BLOG
Project Zero
Project Zero
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
F
Full Disclosure

博客园 - 阿木申

spring JPA 动态查询 iOS收到Push后播放声音和震动 [vb]sendkeys [vb]键盘精灵 - 阿木申 - 博客园 javascript 画带箭头的线段 关于input type='file'的内容的一种解决方法,模拟键盘 - 阿木申 - 博客园 防止IE缓存,就相当于IE选择每次打开就检查 - 阿木申 - 博客园 [dojo] 解决传中文的乱码问题 - 阿木申 - 博客园 [dojo] dojo.xhrGet和.net整合使用 [dojo]日期选择:dijit.form.DateTextbox [dojo]功能强大的文本框:dijit.form.ValidationTextbox - 阿木申 - 博客园 dojo0.9 dojo.data研究笔记 [dojo] dojo 0.9 的使用心得 [原创]jBPM 子流程的使用 [原创]jBPM动态生成任务实例,会签或者分派任务时特别有用 [dojo转]动态生成widget [原创]jBpm中泳道使用心得 [原创]jBPM中的Expression和script [原创]JBPM中的基本操作代码
[dojo]好用的页面对话框dijit.Dialog
阿木申 · 2007-07-27 · via 博客园 - 阿木申

带背景遮罩的对话框:dijit.Dialog

关于dojo的介绍文章:
http://www.dojocn.cn/apage/amushen/archives/2007/15.html
关于dojo的安装文章:
http://www.dojocn.cn/apage/amushen/archives/2007/16.html

这个对话框通用性非常好。而且显示效果比较友好,能给使用者很好的体验。而且无论是正常方式,还是编程方式,实现起来都比较简单。

对话框包括两种,一种是普通的对话框,一种是提示窗口的对话框,用起来都很方便。

下面是一个普通的对话框:

<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(){

              dijit.byId("dialog1").show();        

       }

</script>

<style>

.dijitDialogUnderlay {

       background: #666666;

       opacity: 0.5;

}

</style>

</head>

<body class="tundra">

<button id="b1" onclick="showDia()">显示dojo对话框</button> <br>

<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>

通过编程方式的一个对话框:

<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>

<br>

<select><option>看看对话框能不能挡住这个东西</option></select><br>

<br>

遮罩的颜色可以通过设置.dijitDialogUnderlay来控制

</body>

</html>

提示对话框的例子:

<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">&nbsp;&nbsp;:</label></td>

                                   <td><input type="password" id="pwd"></td>

                            </tr>

                            <tr>

                                   <td colspan="2" align="center">

                                          <button id="hider2">&nbsp;&nbsp;</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.htm

原文地址:http://www.dojocn.cn/apage/amushen/archives/2007/23.html