[英]Open a new page on click of a link on same window
I want to open a page on click of a link on same window. 我想点击同一窗口上的链接打开一个页面。 but the situation is that where the link resided is an Model Popup Extender.
但情况是链接所在的位置是模型弹出扩展器。 After clicking on the link first I close the Model Popup and then open the page.
首先单击链接后,我关闭模型弹出窗口,然后打开页面。 I try two methods.
我尝试了两种方法。
<script language="javascript" type="text/javascript">
function showMessage(err) {
parent.document.getElementById("div1").style.visibility = "hidden";
window.location.href = err; //does't give any result.
window.open (err,'_self',true);//open page in new tab
}
</script>
You can do like this as well 你也可以这样做
window.location.assign(err);
Hope this is valuable information to you. 希望这对您来说是有价值的信息。
function toPage(){
window.open ("http://stackoverflow.com/",'newpage',true);
window.location.href ="https://github.com/";
return false;
}
return is required 返回是必需的
I try this code and it successfully worked. 我尝试这个代码,它成功地工作。
Firstly I sent the control from Child page to parent page, using this code. 首先,我使用此代码将控件从子页面发送到父页面。
<script language="javascript" type="text/javascript">
function openpage(pageurl) {
parent.openNewPage(pageurl);//call a function of parent page
}
</script>
<script language="javascript" type="text/javascript">
function openNewPage(pageurl)
{
window.open(pageurl,"_self","");
}
</script>
It closed first the Model Popup and then opened the new page on parent page. 它先关闭模型弹出窗口,然后在父页面上打开新页面。
thanks a lot all, for your co-operation. 非常感谢你们的合作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.