在页面中使用了showModalDialog,但是在跳转链接时,不会在当前页执行,而是弹出一个新的页面。
方法一
<head>
<base target="_self"/>
<script type="text/javascript">
function go_link()
{
//document.all('editLink').href = "<%=request.getContextPath() %>/mail/check?userid="+userid+"&sfz="+sfz; //url动态改变
document.all('editLink').click();
}
</script>
</head>
<a id="editLink" href="<%=request.getContextPath() %>/mail/sendEmail" style="display:none"></a>
方法二
查看了一下代码,发现跳转链接中使用的是location,而直接使用A生成的链接,在点击跳转时,却不会弹出新的页面。
解决:
通过JS脚本,来模拟点击了A这样的链接,而不使用location试了一下:
复制代码 代码如下:
function go_link(url) {
var link = document.createElement("a");
link.href = url;
document.body.appendChild(link);
link.click();
}
在调用location的地方,改为调用go_link方法。
要同时配合 <base target="_self"/>
分享到:
相关推荐
javascript中showModalDialog子页面值赋给父页面 并解析json格式的值
关于struts2里用javascript刷新window.showModalDialog的父页面
主页面用window.showModalDialog的时候,如果直接打开其它系统的页面,这时候别人的页面在window.returnValue=1;这样返回值的时候,主页面是取不到返回值的,原因就是因为跨域了.
javascript 多层模态窗口showModalDialog页面提交及刷新
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&&open.docx
解决三层或心上showModalDialog的问题_2
Javascript 两个窗体之间传值实现代码javascript中还有一个函数window.showModalDialog也可以打开一个新窗体,不过他打开的是一个模态窗口,那么如何在父窗体和子窗体之间传值呢?我们先看该函数的定义:...
解决三层或心上showModalDialog的问题_js
1. 标准的方法 代码如下: [removed] function openWin(src, width, height, showScroll){ window.showModalDialog (src,””,”location:No;status:No;help:No;dialogWidth:”+width+”;dialogHeight:”+height+”;...
网上找了好几个小时没有找到解决办法。最终还是自己解决了。...这样做就是用超链接把返回url转递到用showModalDialog打开的新窗口中,当showModalDialog返回时指到转来的url,最终不刷新父窗口。......
主要介绍了JavaScript中window.showModalDialog()用法详解,需要的朋友可以参考下
javascript showModalDialog传值与FireFox的window.open 父子窗口传值示例代码。
div层实现showModalDialog
javascript代码模块之\Window.ShowModalDialog使用手册
javascript代码模块之如何使用showModalDialog