手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >javascript showModalDialog 多层模态窗口实现页面提交及刷新的代码
javascript showModalDialog 多层模态窗口实现页面提交及刷新的代码
摘要:在第N(N>1)层的模态页面中,如果想链接到其他页面或者刷新当前页,只能用window.name="__self";window.open(...

在第N(N>1)层的模态页面中,如果想链接到其他页面或者刷新当前页,只能用

window.name = "__self";

window.open(window.location.href, "__self") //注意是2个下划线

替换 location.href

当需要关闭第N(N>1)层的模态窗口,并刷新第N-1层的模态页面时, 为防止刷新时弹出新窗口, 可以通过returnValue 以传递返回值给第N-1层模态窗口,来确认是否需要刷新

在按钮的提交事件中:

代码

复制代码 代码如下:

Response.Write("<script language='javascript'> ");

Response.Write("var w;if(window.dialogArguments != null) w = window.dialogArguments;");

Response.Write("window.returnValue=1;window.close();");

Response.Write("</script>");

在第N-1层模态窗口内控制模态窗口的弹出并确认是否需要刷新该页面

代码

复制代码 代码如下:

<script type="text/javascript">

function OpenShowDialog(id) {

var isReflesh = window.showModalDialog('Test.aspx?id=' + id, window, 'dialogWidth=670px;dialogHeight=250px;status:no;directories:yes;scrollbar:no;Resizable:no');

if (isReflesh == 1) {

window.name = "__self";

window.open(window.location.href, "__self")

}

}

</script>

【javascript showModalDialog 多层模态窗口实现页面提交及刷新的代码】相关文章:

javascript+HTML5自定义元素播放焦点图动画

Ctrl + Enter提交前检测的代码

js禁止页面刷新与后退的方法

javascript实时显示当天日期的方法

JavaScript实现表格点击排序的方法

javascript实现查找数组中最大值方法汇总

javascript原型模式用法实例详解

javascript动态设置样式style实例分析

Javascript实现div层渐隐效果的方法

javascript实现图片跟随鼠标移动效果的方法

精品推荐
分类导航