- 浏览: 183131 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (134)
- java笔记 (25)
- Android开发 (3)
- Mybatis笔记 (1)
- oracle (9)
- javaScript (23)
- struts2 (2)
- jquery (6)
- java多线程 (6)
- 全文检索lucene (1)
- solr4.4 (5)
- solr4.9 (1)
- css 要点 (2)
- fmt格式化 (1)
- 百度地图 (1)
- 显示层jsp (2)
- ant (3)
- 脑袋放水 (2)
- 播放器 (1)
- log日志 (1)
- Spring (1)
- 设计模式 (2)
- httpservlet (1)
- seo (1)
- eclipse使用技巧 (1)
- 正则表达式 (2)
- 我的异常解决方案 (2)
- 集群服务器 (2)
- java网络编程 (3)
- Eclipse快捷键 (1)
- 图片和Base64互转 (1)
- maven (0)
- jsoup 网络爬虫 (1)
- 安全防范 (1)
- 非关系型数据库 (1)
- 在线工具 (1)
- HTML5学习 (1)
- Apache-Mina (1)
最新评论
-
wenjiao8204322:
不好意思说错了,是变量替换后,如果是英文和数字,是不换行的,如 ...
html 转换成pdf -
wenjiao8204322:
楼主你好,有问题、一直难以解决,我们项目上线后,就遗留在这就是 ...
html 转换成pdf -
jacking124:
scoreName 这个属性是做什么的!
jquery.raty-评级插件 -
高军威:
yixiandave 写道高军威 写道alvin198761 ...
Java中的五种实现方法【单例模式】 -
yixiandave:
高军威 写道alvin198761 写道53./** 54. ...
Java中的五种实现方法【单例模式】
基本介绍:
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
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个字符。也可以传递对象,例如:
-------------------------------
parent.htm
<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向打开对话框的窗口返回信息,当然也可以是对象。例如:
------------------------------
parent.htm
<script>
str =window.showModalDialog("modal.htm",,"dialogWidth=200px;dialogHeight=100px");
alert(str);
</script>
modal.htm
<script>
window.returnValue="http://homepage.yesky.com";
</script>
1、基本知识
showModalDialog() (IE 4+ 支持)
showModelessDialog() (IE 5+ 支持)
window.showModalDialog()方法用来创建一个显示HTML内容的模态对话框。
window.showModelessDialog()方法用来创建一个显示HTML内容的非模态对话框。
2、使用方法 vReturnValue=window.showModalDialog(sURL[,vArguments][,sFeatures]);
vReturnValue=window.showModelessDialog(sURL[,vArguments][,sFeatures]);
3、参数说明 参数名称 性质 类型 作用
sURL 必选 字符串 用来指定对话框要显示的网页的URL。
vArguments 可选 变体 用来向对话框传递参数。参数类型不限。
对话框通过window.dialogArguments来取得传递进来的参数。
sFeatures 可选 字符串 用来描述对话框的外观等信息
4、sFeatures参数说明 参数名称 参数属性 说明
dialogHeight npx 对话框高度,不小于100px
dialogWidth npx 对话框宽度
dialogLeft npx 离主窗口左的距离
dialogTop npx 离主窗口上的距离
center {yes | no | 1 | 0 } 窗口是否居中,默认yes
help {yes | no | 1 | 0 } 是否显示帮助按钮,默认yes
resizable {yes | no | 1 | 0 } 是否可改变大小,默认no
status {yes | no | 1 | 0 } 是否显示状态栏,默认为yes[ Modeless]或no[Modal]
dialogHide { yes | no | 1 | 0 | on | off } 在打印或者打印预览时对话框是否隐藏,默认为no
scroll { yes | no | 1 | 0 | on | off } 指明对话框是否显示滚动条,默认为yes
edge { sunken | raised } 指明对话框的边框样式,默认为raised
unadorned { yes | no | 1 | 0 | on | off } 默认为no
注意:dialogHide,edge,unadorned这三个属性是用在HTA(HTML Aplication)中的,一般网页上用不到。
5、参数传递 通过vArguments来传递参数,类型不限制,对于字符串类型,最大为4096个字符,也可以传递对象,例如: parent.htm
<script>
window.showModalDialog("sun.htm","传递进去的参数","help:no;scroll:no");
</script>
sun.htm
<script>
alert("传来的参数:" + window.dialogArguments);
</script>
6、返回值 通过window.returnValue向打开对话框的窗口返回信息,也可以是对象。例如: parent.htm
<script>
result=window.showModalDialog("son.htm","","help:no;scroll:no");
alert(result);
</script>
son.htm
<script>
window.returnValue="这里存放返回的结果";
</script>
7、防止在模态窗口中提交后新开一窗口
在页面的 <body>前加入<base target="_self">
8、调用父窗口的方法同时传递参数 parent.htm
<script>
function show(){//父窗口的方法
alert("show");
}
var arg=new Object();//传递进去的参数
arg.win=window;//把当前窗口的引用当参数传进去
arg.str="argument";//要传进去的其他参数
window.showModalDialog("son.htm",arg,'help:no');
</script>
son.htm
<script>
var arg=window.dialogArguments;
alert(arg.str);
arg.win.show();//调用父窗口的方法
</script>
例子:
但还是推荐大家用jquery,因为他很强大!各种效果!!
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
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个字符。也可以传递对象,例如:
-------------------------------
parent.htm
<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向打开对话框的窗口返回信息,当然也可以是对象。例如:
------------------------------
parent.htm
<script>
str =window.showModalDialog("modal.htm",,"dialogWidth=200px;dialogHeight=100px");
alert(str);
</script>
modal.htm
<script>
window.returnValue="http://homepage.yesky.com";
</script>
1、基本知识
showModalDialog() (IE 4+ 支持)
showModelessDialog() (IE 5+ 支持)
window.showModalDialog()方法用来创建一个显示HTML内容的模态对话框。
window.showModelessDialog()方法用来创建一个显示HTML内容的非模态对话框。
2、使用方法 vReturnValue=window.showModalDialog(sURL[,vArguments][,sFeatures]);
vReturnValue=window.showModelessDialog(sURL[,vArguments][,sFeatures]);
3、参数说明 参数名称 性质 类型 作用
sURL 必选 字符串 用来指定对话框要显示的网页的URL。
vArguments 可选 变体 用来向对话框传递参数。参数类型不限。
对话框通过window.dialogArguments来取得传递进来的参数。
sFeatures 可选 字符串 用来描述对话框的外观等信息
4、sFeatures参数说明 参数名称 参数属性 说明
dialogHeight npx 对话框高度,不小于100px
dialogWidth npx 对话框宽度
dialogLeft npx 离主窗口左的距离
dialogTop npx 离主窗口上的距离
center {yes | no | 1 | 0 } 窗口是否居中,默认yes
help {yes | no | 1 | 0 } 是否显示帮助按钮,默认yes
resizable {yes | no | 1 | 0 } 是否可改变大小,默认no
status {yes | no | 1 | 0 } 是否显示状态栏,默认为yes[ Modeless]或no[Modal]
dialogHide { yes | no | 1 | 0 | on | off } 在打印或者打印预览时对话框是否隐藏,默认为no
scroll { yes | no | 1 | 0 | on | off } 指明对话框是否显示滚动条,默认为yes
edge { sunken | raised } 指明对话框的边框样式,默认为raised
unadorned { yes | no | 1 | 0 | on | off } 默认为no
注意:dialogHide,edge,unadorned这三个属性是用在HTA(HTML Aplication)中的,一般网页上用不到。
5、参数传递 通过vArguments来传递参数,类型不限制,对于字符串类型,最大为4096个字符,也可以传递对象,例如: parent.htm
<script>
window.showModalDialog("sun.htm","传递进去的参数","help:no;scroll:no");
</script>
sun.htm
<script>
alert("传来的参数:" + window.dialogArguments);
</script>
6、返回值 通过window.returnValue向打开对话框的窗口返回信息,也可以是对象。例如: parent.htm
<script>
result=window.showModalDialog("son.htm","","help:no;scroll:no");
alert(result);
</script>
son.htm
<script>
window.returnValue="这里存放返回的结果";
</script>
7、防止在模态窗口中提交后新开一窗口
在页面的 <body>前加入<base target="_self">
8、调用父窗口的方法同时传递参数 parent.htm
<script>
function show(){//父窗口的方法
alert("show");
}
var arg=new Object();//传递进去的参数
arg.win=window;//把当前窗口的引用当参数传进去
arg.str="argument";//要传进去的其他参数
window.showModalDialog("son.htm",arg,'help:no');
</script>
son.htm
<script>
var arg=window.dialogArguments;
alert(arg.str);
arg.win.show();//调用父窗口的方法
</script>
例子:
<html> <head> <title>showModalDialog</title> <script language="JavaScript"> //aInfo作为数组对象,将被showModalDialog传递到子页面(或叫模式窗体,指当显示页面未关闭前,不能对父页面操作) //也可用var oMyobject=new Object(); //oMyobject.firstProperty = value; oMyobject.lastProperty = value;的方式定义一个对象(firstProperty,lastProperty是自己按需定义的对象属性,可是任意取名并赋值) var aInfo = new Array(3); aInfo[0] = "aaaaaaaaaaa"; aInfo[1] = "bbbbbbbbbbb"; aInfo[2] = "ccccccccccc"; var url = "dialog.html"; var sFeatures = "width=500px;height=500px;edge=sunken"; function gg(){ //弹出一个showModalDialog,并以returnValue来获取返回值 var returnValue = window.showModalDialog(url,aInfo,sFeatures); if(returnValue!=null){ alert(returnValue); } } </script> </head> <body> <h3><input type="button" onClick="gg();" value="打开Dialog窗口"></h3> <div ></div> </body> </html>
<html> <head> <title>Dialog</title> <script language="JavaScript"> <!-- //获取父窗口传来的对象(本例中就是父页面中的“oInfo”数组对象,也可用“window”对象,以便对父页面进行操作。总之,只要是object类型就成。) var args = window.dialogArguments;//获取父页面传递过来的值; if(args!=null){ //document.write(args); for(var i=0;i<args.length;i++){ document.writeln(args[i]+" "+(i+1)); } }else{ alert("对不起,参数为空"); } function hh(){ var names = document.getElementById("names").value; window.returnValue = names; this.window.close(); } //向父窗口返回的值 //--> </script> </head> <body> <input type="text" id="names" name="names"/> <input type="button" onClick="hh();" value="测试"/> </body> </html>
但还是推荐大家用jquery,因为他很强大!各种效果!!
发表评论
-
js常用的对象扩展方法
2016-02-16 17:03 1401/** * js bug:解决 javascript ... -
js日期溢出
2015-06-17 17:15 894//有溢出问题 function js_patch_ge ... -
向上滚动到浏览器顶部固定住,向下滚动出浏览器顶部回复原状
2015-05-06 15:55 1244js代码: //当滚动到浏览器顶部时 浮动固定 不随网页滚 ... -
一个页面多个倒计时js代码
2015-04-15 10:17 1176粗略的整理下 解决需求: 1.解决一个页面多个倒计时 2.每 ... -
网页 返回头部
2015-01-09 14:36 696网上各种各样的眼花缭乱,索性自己写一个,这只是个简单的例子, ... -
页面复制文本信息
2015-01-05 12:56 674<!DOCTYPE html PUBLIC &quo ... -
IE 玛德好霸道,就你特殊
2014-10-24 15:31 441尼玛一. document.getElementsByNa ... -
js代码
2014-10-22 16:19 0$(document).ready(function() { ... -
得到浏览器尺寸,判断浏览器内核
2014-10-09 13:24 1096效果图: 代码部分: <!DOCTYPE ht ... -
Js汉字和Unicode编码互转 Unicode加密 Unicode解密
2014-08-11 15:19 1190加密是为了保护源代码;解密是为了看到源代码 参考文档: htt ... -
js运算bug,等等
2014-06-23 15:48 0/** * js bug:解决 javascript ... -
Ajax表单提交的特殊字符处理
2014-05-09 11:32 794封装成json格式在提交就没有为题了 W3 ... -
复选框 浏览器兼容问题解决方案
2014-01-03 10:41 839需求,会员注册,勾选统一注册协议复选框,按钮变 亮可用, 不勾 ... -
选中复选框后按钮可用,不选中不可用
2013-11-29 10:37 1367<input type="checkbox ... -
CSS中的绝对定位与相对定位
2013-11-26 16:35 601... -
Jquery 收藏本站代码
2013-10-29 15:45 1657//收藏本站代码 jQuery.fn.addFavo ... -
ie6和ie7下z-index bug的解决办法
2013-09-24 14:43 1040在CSS中,显然,只能通过代码改变层级,这个属性就是z-ind ... -
【转】jsp、freemarker、velocity比较
2013-09-11 14:27 1036在java领域,表现层技术主要有三种:jsp、freemark ... -
常用js方法
2013-07-29 11:12 999·1.回车触发事件 onkeydown="if(ev ... -
图片上下无间隙滚动
2013-07-19 17:52 1109图片上下无间隙滚动↓↓↓↓↓↓
相关推荐
`window.showModalDialog` 和 `window.open` 都是JavaScript提供的两种打开新窗口的方法,但它们在功能和使用场景上有着显著的区别。 首先,我们来详细探讨`window.showModalDialog`。`showModalDialog`方法用于...
### Window.ShowModalDialog 使用手册详解 #### 一、概述 `Window.ShowModalDialog` 是一个在 Internet Explorer 浏览器中特有的方法,用于创建模态对话框。此方法允许开发者在一个新的窗口中打开一个HTML页面,...
1. 使用`window.showModalDialog`打开一个包含`iframe`的页面,`iframe`加载目标站点。 2. 目标站点通过修改`iframe`的`src`属性或提交表单等方式与主页面通信。 3. 主页面通过URL参数接收目标站点返回的值,并关闭`...
Window.showModalDialog 和 Window.open 用法简介 Window.showModalDialog 和 Window.open 都是 JavaScript 中的方法,用于创建新窗口或对话框,下面分别介绍它们的用法和参数。 一、Window.open() 方法 Window....
本文将详细介绍`window.showModalDialog`的使用方法及其相关知识点。 1. **基本语法** `window.showModalDialog` 的基本调用形式如下: ```javascript var returnValue = window.showModalDialog(url, window, ...
This is a `window.showModalDialog()` shim using a modal HTML5 `<dialog>` element and ECMAScript 6 Generators. It was tested in the latest Google Chrome with the *Enable Experimental JavaScript* flag ...
### JS弹出对话框 `window.showModalDialog()` 的使用与详解 #### 一、`window.showModalDialog()` 概述 在JavaScript中,`window.showModalDialog()` 是一个非标准但广泛使用的API,用于创建模态对话框。模态...
下面我们将详细探讨`window.showModalDialog`的使用及其相关知识点。 首先,`window.showModalDialog`的基本语法如下: ```javascript var returnValue = window.showModalDialog(url, [dialogArguments], ...
本文将重点介绍模态对话框的使用方法`window.showModalDialog()`。 模态对话框是一种阻止用户与网页其他部分互动,直到关闭对话框为止的交互方式。`window.showModalDialog()`是Internet Explorer 4及更高版本支持...
window.showModalDialog以及window.open用法简介
### window.showModalDialog 的基本用法 `window.showModalDialog` 是一个早期的浏览器功能,主要在 Internet Explorer(IE)4.0 及以上版本中支持。它用于打开一个新的模态对话框窗口,并且该窗口将阻止用户与主...
**Window.showModalDialog 使用手册** `window.showModalDialog` 是Internet Explorer 4+ 版本开始支持的一个方法,用于创建一个模态对话框,显示HTML内容。模态对话框意味着用户必须关闭对话框才能继续与主窗口...
- **安全性考虑**:使用`window.showModalDialog`时需要注意防止XSS攻击等问题。 - **性能优化**:频繁地刷新页面可能会导致性能下降,建议优化数据处理逻辑减少不必要的刷新。 #### 总结 通过以上步骤,我们可以...
主页面用window.showModalDialog的时候,如果直接打开其它系统的页面,这时候别人的页面在window.returnValue=1;这样返回值的时候,主页面是取不到返回值的,原因就是因为跨域了.
`window.showModalDialog` 是一个在JavaScript中用于打开模态对话框的函数,它在Web开发中被广泛使用,特别是在创建自定义对话框时。在这个示例中,我们有一个名为"TestWindowDialog"的压缩包文件,其中包含了实现`...
通过 `ShowModalDialog` 打开的窗口可以使用 `window.returnValue` 设置返回值。当对话框关闭时,这个值将被传递给调用 `ShowModalDialog` 的函数。 #### 五、示例代码 下面是一个简单的示例,展示了如何使用 `...