`

window.showdialog

阅读更多
window.showdialog

window.showdialog完全手册,解决模态窗口,传值和返回值问题2009-08-28 13:31基本介绍:
showModalDialog() (IE 4+ 支持)
showModelessDialog() (IE 5+ 支持)
window.showModalDialog()方法用来创建一个显示HTML内容的模态对话框。
window.showModelessDialog()方法用来创建一个显示HTML内容的非模态对话框。

使用方法:
vReturnValue = window.showModalDialog(sURL [, vArguments] [,sFeatures])
vReturnValue = window.showModelessDialog(sURL [, vArguments] [,sFeatures])

参数说明:
sURL--必选参数,类型:字符串。用来指定对话框要显示的文档的URL。
vArguments--可选参数,类型:变体。用来向对话框传递参数。传递的参数类型不限,包括数组等。对话框通过window.dialogArguments来取得传递进来的参数。
sFeatures--可选参数,类型:字符串。用来描述对话框的外观等信息,可以使用以下的一个或几个,用分号“;”隔开。
1.dialogHeight :对话框高度,不小于100px,IE4中dialogHeight 和 dialogWidth 默认的单位是em,而IE5中是px,为方便其见,在定义modal方式的对话框时,用px做单位。
2.dialogWidth: 对话框宽度。
3.dialogLeft: 离屏幕左的距离。
4.dialogTop: 离屏幕上的距离。
5.center: {yes | no | 1 | 0 }:窗口是否居中,默认yes,但仍可以指定高度和宽度。
6.help: {yes | no | 1 | 0 }:是否显示帮助按钮,默认yes。
7.resizable: {yes | no | 1 | 0 } [IE5+]:是否可被改变大小。默认no。
8.status: {yes | no | 1 | 0 } [IE5+]:是否显示状态栏。默认为yes[ Modeless]或no[Modal]。
9.scroll:{ yes | no | 1 | 0 | on | off }:指明对话框是否显示滚动条。默认为yes。
下面几个属性是用在HTA中的,在一般的网页中一般不使用。
10.dialogHide:{ yes | no | 1 | 0 | on | off }:在打印或者打印预览时对话框是否隐藏。默认为no。
11.edge:{ sunken | raised }:指明对话框的边框样式。默认为raised。
12.unadorned:{ yes | no | 1 | 0 | on | off }:默认为no。

参数传递:
1.要想对话框传递参数,是通过vArguments来进行传递的。类型不限制,对于字符串类型,最大为4096个字符。也可以传递对象,例如:


<script>
var obj = new Object();
obj.name="51js";
window.showModalDialog("modal.htm",obj,"dialogWidth=200px;dialogHeight=100px");
</script>
modal.htm
<script>
var obj = window.dialogArguments
alert("您传递的参数为:" + obj.name)
</script>


2.可以通过window.returnValue向打开对话框的窗口返回信息,当然也可以是对象。例如:

<script>
str =window.showModalDialog("modal.htm",,"dialogWidth=200px;dialogHeight=100px");
alert(str);
</script>
modal.htm
<script>
window.returnValue="/";
</script>



  


  
分享到:
评论

相关推荐

    Window.showDialog详解合集

    详解JSP里面的window.showDialog的用法,及页面间参数传递 如何获取弹出框关闭的返回值,模态对话框的操作。

    greybox封装为一个控件

    window.showDialog();用层模拟,框架+DIV+Javascript.... 用window.open();这种方法的缺点是,会被浏览器或者相关软件给屏蔽掉。用层模拟的话,如果想实现较复杂点的窗口,就比较困难,第三种方法是综合了所有的...

    JS中表单的使用小结

    使用window.showDialog弹出的模式窗口 window.dialogArguments.location.reload(); 2.javascript弹出窗口的两种实现方式 —下面给两个弹出屏幕居中窗口的例子 window.open()方式 代码如下: function ShowDialog...

    自定义Dialog弹窗

    Window dialogWindow = getWindow(); WindowManager.LayoutParams lp1 = dialogWindow.getAttributes(); WindowManager wm = (WindowManager) getContext() .getSystemService(Context.WINDOW_SERVICE); ...

    window.show

    showdialog,showmodeldialog,dialog,弹出窗口

    窗体居中-适合MessageBox等

    using (new CenterWindow(this.Handle)) //父级中央 { this.openFileDialog1.ShowDialog(this); }

    基于Window mobile 6 程序设计——文本编辑器

    此程序可以是用VS2008开发的,语言为C#,运行环境Window Mobile 6的模拟器。效果良好。 private void menuItem7_Click(object sender, EventArgs e) {//打开 textBox1.ReadOnly = false;//textBox1设置为非只读...

    javascript之弹出窗口居中的代码

    代码如下:window.open()方式 function ShowDialog(url) { var iWidth=300; //窗口宽度 var iHeight=200;//窗口高度 var iTop=(window.screen.height-iHeight)/2; var iLeft=(window.screen.width-iWidth)/2; window...

    window.showModalDialog参数传递中含有特殊字符的处理方法

    程序运行出错经,过检查发现传递的数据中出现了#等特殊字符,浏览器只取到#号前面的数据,后面的被截断,下面为大家介绍下正确的处理方法

    浮点vfdsfJAVA实现链表,双向链表.txtJAVA实现链表,双向链表.txt

    &lt;!-- public topnav --&gt; ... &lt;!-- //public topnav --&gt; &lt;!-- 广告位:下载频道首页头文件上 220*90 --&gt; &lt;script type="text/javascript"&gt;BAIDU_CLB_fillSlot("198363");...-- 广告位:下载频道首页头文件上 ...

    C# 俄罗斯方块游戏

    C#做的俄罗斯方块游戏using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Xml;...using System.Security.Cryptography;...

    Java NIO 聊天室 JSwing

    public void closeWindow(final BootEndInterface ed) { this.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e1) { ed.end(); } }); } public void ...

    wpf地震体浏览工具(源码)

    openSegyFile.ShowDialog(); text_SegyFilePath.Text = openSegyFile.FileName; // string strValue = m_CSegy.GetProtectedStr(); // string strValueTest = m_CSegyScan.GetProtectedStr(); // strValueTest = m...

    WpfApp.rar

    public partial class PrintPreviewWindow : Window { private delegate void LoadXpsMethod();//委托事件,相当于函数指针 private readonly FlowDocument m_doc;//流文档 public PrintPreviewWindow(string ...

    js showModalDialog弹出窗口实例详解

    使用方法: vReturnValue = window.showModalDialog(sURL [, vArguments] [,sFeatures])  参数说明: sURL– 必选参数,类型:字符串。用来指定对话框要显示的文档的URL。  vArguments– 可选参数,类型:变

    Android 日期控件只显示年月

    requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.main); initUi(); button.setOnClickListener(this); } public void initUi() { button = (Button) findViewById(R.id....

    JavaScript实现弹出子窗口并传值给父窗口

    新建父窗口页面: 加入以下脚本 代码如下: &lt;html xmlns=”http://www.w3.org/1999/xhtml” ... &lt;head runat=”server”&gt;  &lt;...function ShowDialog(Url) ... var iTop=(window.screen.height-iHeight-100)/2

    FastReport问题集

    A: 在导入组件(比如,TfrTextExport)中设置所有必需的选项,然后通过设置ShowDialog属性为False来关闭此对话框。 Q: 为什么 TotalPages 变量不起作用? 它总是返回 0. A: 在你的报表中设置 Two-pass 选项. 要设置...

    LHGDialog V3.5.2 正式版 lhgDialog弹出窗口组件 lhgdialog V3.5.2

    ShowDialog() :显示窗口无参数,jQ调用方式不需要加此方法。 cancel() :关闭窗口无参数。 reDialogSize(width,height) :重新指定窗口的大小参数1:窗口的宽度,如:600,不带单位的数字 参数2:窗口的高度,...

    WPF弹出带蒙板的消息框

    先看看效果图   思路 拿到父级窗体的内容,放入一个容器里,再在容器里放入一个半透明层....public static void ShowDialog(string message, Window owner) { //蒙板 Grid layer = new Grid() { Backgrou

Global site tag (gtag.js) - Google Analytics