window.open和window.showModalDialog区别:
1.都是在IE上打开新窗口,只不过前者是非阻塞式,也可以说非模态窗口。而后者是阻塞式模态窗口。阻塞或者模态窗口,只有你把当前窗口关闭后,才能去操作父亲窗口。
2.参数上:
oNewWindow = window.open( [sURL] [, sName] [, sFeatures] [, bReplace])打开新窗口并装入给定 URL 的文档。
返回值:返回打开的新窗口对象
sURL:可选参数,要打开新窗口的地址url.
sName:可选参数,新窗口的句柄名,常用的四种有:_blank,_parent,_top,_self.
sFeatures:可选参数,IE窗口相关的特性,有height,width,left.top,location,menubar,resizable,scrollbars,status,titlebar,toolbar,还有channelmode,directories和fullscreen(全屏模态)特殊参数.
sReplace:可选参数
example:window.open("Sample.htm",null,"height=200,width=400,status=yes,toolbar=no,menubar=no,location=no");
window.showModalDialog()创建一个显示指定 HTML 文档的模式对话框。
vReturnValue = window.showModalDialog(sURL [, vArguments] [, sFeatures])
sURL:可选参数,要打开新窗口的地址url.
vArguments:可选参数,可用来向子窗口传递参数.用来向对话框传递参数。传递的参数类型不限,包括数组等。对话框通过window.dialogArguments来取得传递进来的参数。 这个参数隐藏掉,不用放在url里,提高了安全性。
sFeatures:可选参数,dialogHeight,dialogWidth,dailogLeft,dialogTop,center,dialogHide,edge,help,resizable,scroll,status,unadorned.
3.传参安全性: 1)window.open(),通过创建form提交,以post提交,参数传参安全了。如下: function openPostWindow(url, data, name) { var tempForm = document.createElement("form"); tempForm.id="tempForm1"; tempForm.method="post"; tempForm.action=url; tempForm.target=name; var hideInput = document.createElement("input"); hideInput.type="hidden"; hideInput.name= "content" hideInput.value= data; tempForm.appendChild(hideInput); tempForm.attachEvent("onsubmit",function(){ openWindow(name); }); document.body.appendChild(tempForm); tempForm.fireEvent("onsubmit"); tempForm.submit(); document.body.removeChild(tempForm); } function openWindow(name) { window.open('about:blank',name,'height=400, width=400, top=0, left=0, toolbar=yes, menubar=yes, scrollbars=yes, resizable=yes,location=yes, status=yes'); } 2).window.showModalDialog传参安全,通过第二个参数vArguments传递参数,然后在子页面中,再用window.dialogArguments获传递的参数. .
相关推荐
NULL 博文链接:https://shawnfree.iteye.com/blog/598885
window.showModalDialog以及window.open用法简介
window.showModalDialog以及window.open用法简介
ShowModalDialog函数的功能: 使用方法: 参数说明:
showModalDialog和window.open
本文实例讲述了js的window.showModalDialog及window.open用法。分享给大家供大家参考。具体分析如下: 一、window.open()支持环境: JavaScript1.0+/JScript1.0+/Nav2+/IE3+/Opera3+ 二、基本语法: window.open...
window.showModalDialog&&open.docx
1> window.showModalDialog()采用JS原理实现,同时父窗口不可操作,window.open()采用新创建一个窗口,同时父窗口可操作; 2> 父窗口与子窗口传递值的方式也有所不同,在子窗口中操作父窗口也语法也不同,分别为var...
window.open()和window.showModalDialog(),并解决了showModalDialog()弹出窗口中列表分页的问题。 提供了三个JS方法: (1)showWindow(sURL, width, height); (2)showWindowInPage(pageUrl, params, title, ...
window.open 函数的操作 取出showModalDialog中传过来的数据对象 request.getParameterMap()相关的操作实例
一个是window.showModalDialog()方法,后者是存在父子关系的一种弹出窗口,只有子窗关闭,父窗口才激活,并且可以传送参数和返回值。正好又温习一遍用法,顺便在此记录过程中遇到的问题。 基本介绍: ...
window.showModalDialog()方法用来创建一个显示HTML内容的模态对话框,由于是对话框,因此它并没有一般用window.open()打开的窗口的所有属性。 window.showModelessDialog()方法用来创建一个显示HTML内容的非模态
showModalDialog是jswindow对象的一个方法,和window.open一样都是打开一个新的页面。区别是:showModalDialog打开子窗口后,父窗口就不能获取焦点了(也就是无法操作了)。可以在子窗口中通过设置window.return...
因为项目中使用showModalDialog函数的地方特别多,所以必须用一个类似方法实现功能,也就是window.open() 首先是判断子窗口关闭,因为项目是在子窗口关闭(确定按钮)的时候向父页面传递值的。
嗨,Kavita3,它是Chrome浏览器中的一个已知问题,您可以使用window.open();希望对您有用
javascript showModalDialog传值与FireFox的window.open 父子窗口传值示例代码。