//创建一个显示html内容的模态对话框:

vReturnValue = window.showModalDialog(sURL [, vArguments] [,sFeatures])

//创建一个显示html内容的非模态对话框:

vReturnValue = window.showModelessDialog(sURL [, vArguments] [,sFeatures])

sURL:(必选参数)字符串..指定要显示的文档的URL

vArguments:任意类型..想要显示的页面传递参数..参数可以使用window.dialogArguments来获取

sFeatures:字符串..指定对话框的样式..里面可以定义一个也可以多个使用分号";"分开
1.   dialogHeight:   对话框高度,不小于100px

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。

父窗口:

 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script type="text/javascript">
function openWin(){
window.showModalDialog("a2.jsp",window,"dialogHeight:300px;dialogWidth:380px;status=no;help:yes;");
} function setValue(cid,cname){
document.getElementById("cid").value=cid;
document.getElementById("cname").value=cname;
}
</script>
</head>
<body>
<form action="test.jsp" name="form1" method="post">
客户id:<input type="text" name="cid" value="" id="cid"/><br>
客户名称:<input type="text" name="cname" value="" id="cname">
<input type="button" name="ok" value="请选择客户" onclick="openWin();">
</form>
</body>
</html>

子窗口:

 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script type="text/javascript">
function viewData(cid,cname){
//alert(cid+" "+cname);
/*
*父窗体页面的window对象
*子窗体页面的window.dialogArguments对象中封装的是父窗体页面的信息
*/
var sdata=window.dialogArguments; /*sdata封装的是父窗体页面的信息*/
//alert(sdata);
sdata.setValue(cid,cname);;
window.close();
}
</script>
</head> <body>
<table border="1">
<tr>
<td>操作</td>
<td>客户id</td>
<td>客户名称</td>
</tr>
<tr>
<td><input type="button" value="选择" id="ss" onclick="viewData('001','深圳华为');"/></td>
<td>001</td>
<td>深圳华为</td>
</tr>
<tr>
<td><input type="button" value="选择" id="ss" onclick="viewData('002','用友软件');"/></td>
<td>002</td>
<td>用友软件</td>
</tr>
</table>
</body>
</html>

window.showModalDialog()的简单用法的更多相关文章

  1. window.showModalDialog的基本用法

    window.showModalDialog的基本用法 showModalDialog() (IE 4+ 支持) showModelessDialog() (IE 5+ 支持) window.show ...

  2. window.showModalDialog的简单实践

    Super.jsp - 父窗口 <%@ page language="java" import="java.util.*" pageEncoding=&q ...

  3. window.showModalDialog()之返回值

    window.showModalDialog的基本用法 showModalDialog() (IE 4+ 支持) showModelessDialog() (IE 5+ 支持) window.show ...

  4. window.showModalDialog以及window.open用法简介

    .可以通过window.returnValue向打开对话框的窗口返回信息,当然也可以是对象.例如:------------------------------parent.htm<script& ...

  5. 关于window.showModalDialog的一些配置

    关于window.showModalDialog的一些配置 一.window.showModalDialog的滚动条 其实纵向滚动条很好去掉,难办的就是横向滚动条.在Firefox下如果window. ...

  6. window.showModalDialog 与window.open传递参数的不同?

    简单的说,就是一个在弹出窗口之后可以做其它的事,即window.open 另一个在弹出窗口之后不能做其它的事,只能是关闭了当前的窗口之后才能做其它的事,即window.showModalDialog ...

  7. Ext.Net学习笔记19:Ext.Net FormPanel 简单用法

    Ext.Net学习笔记19:Ext.Net FormPanel 简单用法 FormPanel是一个常用的控件,Ext.Net中的FormPanel控件同样具有非常丰富的功能,在接下来的笔记中我们将一起 ...

  8. WPF之Treeview控件简单用法

    TreeView:表示显示在树结构中分层数据具有项目可展开和折叠的控件 TreeView 的内容是可以包含丰富内容的 TreeViewItem 控件,如 Button 和 Image 控件.TreeV ...

  9. window.open || window.showModalDialog || window.showModelessDialog

    http://dwcmayday201204063551.iteye.com/blog/1621751 http://www.cnblogs.com/zhangyi85/archive/2009/09 ...

随机推荐

  1. 【.NET】Repeater控件简单的数据绑定(有bool,日期,序号)

    前述: 讲的是Repeater,使用的是XML文件读取,没用ADO.NET ,而分页有很多方法,比如用PagedDataSource,或者通过参数在数据源写SQL语句来实现. 页面: <%@ I ...

  2. C#隐藏tabcontrol

    //tabControl1.SizeMode = TabSizeMode.Fixed; //tabControl1.ItemSize = new Size(0, 1);

  3. [Q]pdfFactory虚拟打印机的安装

    安装打图精灵过程中会提示是否安装pdfFactory虚拟打印机,建议选择安装. 若未安装,在安装打图精灵之后想安装pdfFactory,该软件可以在打图精灵应用程序文件夹下找到( 系统"开始 ...

  4. c#语言简介

    语言的历史:c,c++,java,c#, c语言最早,c++语言复杂,而java把其中难的一部分去掉,也成为c--,而c#早期类似java. c#简单高效,并且与web结合. C#的运行环境是.net ...

  5. c#发送http请求注意

    这里要注意几个点:第一就是编码,如果编码不对,容易中文乱码第二就是ContentType 如果设置不对,有可能连方法都调试不进去(我api用的是MVC的普通controller)第三就是paramDa ...

  6. 9、JavaScript常用函数

    1.alert()函数 用于弹出消息对话框提示用户信息,消息对话框由系统提供,不同浏览器中字体样式可能不同,通常用于调试程序. 2.confirm()函数 弹出一个OK按钮和一个Cancel按钮的消息 ...

  7. 推荐几个好的 Maven 常用仓库网址

    注意,以下内容转载自:推荐几个好的 Maven 常用仓库网址 Maven 确确实实是个好东西,用来管理项目显得很方便,但是如果是通过 Maven 来远程下载 JAR 包的话,我宿舍的带宽是4兆的,4个 ...

  8. HDU 3294 Girls' research

    题目地址 manacher #include<cstdio> #include<string.h> #include<algorithm> using namesp ...

  9. NS_ASSUME_NONNULL_BEGIN 延伸

    NS_ASSUME_NONNULL_BEGIN和NS_ASSUME_NONNULL_END 在.h文件中,可以看到这两个宏,翻看定义,这两个宏的代码是 #define NS_ASSUME_NONNUL ...

  10. 批量安装XP补丁的命令

    方法一: 新建一个bat文件,把这个文件和所有补丁文件放在同一个目录下,双击运行. BAT代码如下 @echo offfor %%i in (*.exe) do %%i /passive /nores ...