window.showModalDialog传值并刷新父窗口示例,father.html
<!DOCTYPEHTML PUBLIC "-//W3C//DTD HTML 4.0Transitional//EN">
<HTML>
<HEAD>
<TITLE>传值+刷新父窗口</TITLE>
<mce:scriptlanguage="javascript"><!--
functionopenson(){
var obj = newObject();
obj.name="张三";
obj.address="中国北京市";
var k=window.showModalDialog("child.html",obj,"dialogWidth:800px;dialogHeight:600p;status:no;");
if(k.type==""){//传递回的type为空的时候才刷新页面。
alert("刷新了"); //为了看效果加的,实际运用中请注掉
location.reload();
}
}
//--></mce:script>
</HEAD>
<BODY>
<inputtype="button" value="打开子窗口"onclick="openson()">
</BODY>
</HTML>
===================================================
child.html
<!DOCTYPEHTML PUBLIC "-//W3C//DTD HTML 4.0Transitional//EN">
<HTML>
<HEAD>
<TITLE></TITLE>
<mce:scriptfor="window"event="onload"><!--
var s = new Object();
s.type="";
window.returnValue=s;
vark=window.dialogArguments;
alert(k.name); //使用传递过来的nanme "张三“;
alert(k.address);//使用传递过来的address "中国北京市“;
//--></mce:script>
<mce:scripttype="text/javascript"><!--
function doRefresh(){
var s=new Object();
s.type="";//设置返回值。//这里返回刷新父页面。
window.returnValue=s;
window.close();
}
functiondoNotRefresh(){
var s=newObject();
s.type="OK";//设置返回值,值随便写,不为空就可以。//这里返回不刷新父页面。
window.returnValue=s;
window.close();
}
//--></mce:script>
</HEAD>
<BODY>
<inputtype="button" value="返回刷新"onclick="doRefresh()">
<input type="button" value="返回不刷新"onclick="doNotRefresh()">
</BODY>
</HTML>
window.showModalDialog传值刷新应用示例、
window.showModalDialog传值刷新应用示例,传值+刷新的实际应用
parent3.html
<!DOCTYPE HTMLPUBLIC "-//W3C//DTD HTML4.0 Transitional//EN">
<HTML>
<HEAD>
<title>传值+刷新</title>
<mce:scripttype="text/javascript"><!--
functionshow(){
var params = newArray();
params[0] ="00000000000";
params[1]="1111111111";
params[2]="22222222222";
var style ="dialogHeight:600px;dialogWidth:800px;status:no";
vark=window.showModalDialog("son3.html",params,style);
if(k.type==""){//传递回的type为空的时候才刷新页面。
alert("刷新我了");
location.reload();
}
}
//--></mce:script>
</HEAD>
<BODY>
<inputtype="button" value="open"onclick="show()">
aaaaaaaaaaaaaaaaaanfddddaas
<inputtype="text">
</BODY>
</HTML>
son3.html
<!DOCTYPE HTMLPUBLIC "-//W3C//DTD HTML4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> NewDocument </TITLE>
<mce:scripttype="text/javascript"><!--
var s = newObject();
s.type="";//设为空就可以刷新父窗口
window.returnValue=s;
var l_array=new Array();
l_array=window.dialogArguments;
varaa=l_array[0];
varbb=l_array[1];
var cc=l_array[2];
alert(aa);
alert(bb);
alert(cc);
function closeWindow(){
window.close();
}
functiondoNotRefresh(){
var s=newObject();
s.type="OK";//设置返回值,值随便写,不为空就可以。//这里返回不刷新父页面。
window.returnValue=s;
window.close();
}
//--></mce:script>
</HEAD>
<BODY>
sdafsdfafasdf<br>
<inputtype="button" value="closeAndRefresh"onClick="closeWindow()" />
<input type="button" value="closeAndRefresh"onClick="doNotRefresh()" />
</BODY>
</HTML>
window.showModalDialog只传值不刷新的示例
window.showModalDialog只传值不刷新的示例,只传值不刷新
parent2.html
<!DOCTYPE HTMLPUBLIC "-//W3C//DTD HTML4.0 Transitional//EN">
<HTML>
<HEAD>
<mce:scripttype="text/javascript"><!--
functionshow(){
var params = newArray();
params[0] ="00000000000";
params[1]="1111111111";
params[2]="22222222222";
var style ="dialogHeight:600px;dialogWidth:800px;status:no";
window.showModalDialog("son2.html",params,style);
}
//--></mce:script>
</HEAD>
<BODY>
<inputtype="button" value="open"onclick="show()">
aaaaaaaaaaaaaaaaaanfddddaas
<inputtype="text">
</BODY>
</HTML>
===================================================
son2.html
<!DOCTYPE HTMLPUBLIC "-//W3C//DTD HTML4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> NewDocument </TITLE>
<mce:scripttype="text/javascript"><!--
var l_array=newArray();
l_array=window.dialogArguments;
varaa=l_array[0];
varbb=l_array[1];
varcc=l_array[2];
alert(aa);
alert(bb);
alert(cc);
//--></mce:script>
</HEAD>
<BODY>
ssssssssssssssssssssssssssssssssss
</BODY>
</HTML>
window.showModalDialog刷新父窗口不传值的示例
window.showModalDialog刷新父窗口不传值的示例,刷新父窗口(没有传值操作)
父页面打开时一定要传window参数
openModalDialog("son.html",window,800,600);
子页面中刷新:
window.dialogArguments.location="parent.html";//parent.html是父页面的地址
实例:
parent.html
<!DOCTYPE HTMLPUBLIC "-//W3C//DTD HTML4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE></TITLE>
<mce:scripttype="text/javascript"><!--
functionopenModalDialog(url,name,iWidth,iHeight)
{
window.showModalDialog(url,name,'edge:Raised; center: Yes; help: Yes; resizable: Yes; status:No;dialogHeight:'+iHeight+'px;dialogWidth:'+iWidth+'px');
}
functionshow(){
openModalDialog("son.html",window,800,600);
}
//--></mce:script>
</HEAD>
<BODY>
<inputtype="button" value="open"onclick="show()">
</BODY>
</HTML>
================================================
son.html
<!DOCTYPE HTMLPUBLIC "-//W3C//DTD HTML4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> NewDocument </TITLE>
<mce:scripttype="text/javascript"><!--
functionaa(){
self.close();
window.dialogArguments.location="parent.html";
}
//--></mce:script>
</HEAD>
<BODY>
ssssssssssssssssssssssssssssssssss
<inputtype="button" value="close"onclick="aa()">
</BODY>
</HTML>
本文来自: IT知道网(http://www.itwis.com/)
详细出处参考:http://www.itwis.com/html/programme/javascript/20101015/9289.html
分享到:
相关推荐
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 ...
window.showModalDialog以及window.open用法简介
针对window.showmodaldialog弹出窗体无刷新的详细使用
window.showModalDialog以及window.open用法简介
NULL 博文链接:https://shawnfree.iteye.com/blog/598885
window.showModalDialog的基本用法
javascript代码模块之\Window.ShowModalDialog使用手册
使用window.showModalDialog的程序员都知道,该方法可返回值。但是如果遇到跨域时,就返回为underfine。本文档通过iframe镶嵌页面解决该问题。
window.showModalDialog&&open.docx
主页面用window.showModalDialog的时候,如果直接打开其它系统的页面,这时候别人的页面在window.returnValue=1;这样返回值的时候,主页面是取不到返回值的,原因就是因为跨域了.
关于struts2里用javascript刷新window.showModalDialog的父页面
网上找了好几个小时没有找到解决办法。最终还是自己解决了。...这样做就是用超链接把返回url转递到用showModalDialog打开的新窗口中,当showModalDialog返回时指到转来的url,最终不刷新父窗口。......
javascript代码模块之window.showModalDialog方法的使用
showModalDialog刷新窗口的例子
JS 弹出对话框window.showModalDialog,级联方式,可以返回传值给页面
Window.ShowModalDialog使用手册_对话框 .txt 详细
1> window.showModalDialog()采用JS原理实现,同时父窗口不可操作,window.open()采用新创建一个窗口,同时父窗口可操作; 2> 父窗口与子窗口传递值的方式也有所不同,在子窗口中操作父窗口也语法也不同,分别为var...
javascript showModalDialog传值与FireFox的window.open 父子窗口传值示例代码。