框架关闭并重定向新的URL打开同一个窗口

时间:2013-06-07 06:40:56

标签: php javascript

如何关闭框架并将新网址重定向到同一窗口中打开?

此处框架已关闭,但未重定向到google.com。

代码:

function close_pay3() {
  window.parent.$(".effect" ).hide('clip', 1000 ); 
  return false;
  window.open('https://www.google.com','_self');
}
<a href="#" style="text-decoration:none;"><input type="button" onClick="close_pay3()" class="close-btn" value="Login" name="boxclose" />  
</a>

4 个答案:

答案 0 :(得分:3)

您{window}打开函数前return ...将return false;作为最后一行。

答案 1 :(得分:2)

function close_pay3() {
    window.parent.$(".effect").hide('clip', 1000,function(){
      window.open('https://www.google.com', '_self');

     });

}

<a href="#" style="text-decoration:none;"><input type="button" onClick="close_pay3(); return false;" class="close-btn" value="Login" name="boxclose" />  
</a>

答案 2 :(得分:1)

您已将all函数()放在弹出框中。

function close_pay3()
{ $(".effect" ).hide('clip', 1000 );
window.parent.document.getElementById('krish').style.display="none";
window.location.href = "https://google.com";
return false;
}<input type="button" onClick="javascript:window.parent.close_pay3()" class="close-btn" value="Login" name="boxclose" />

答案 3 :(得分:0)

返回false;

之后应该是最终的
window.open('https://www.google.com', '_self');
return false;