这是我的代码。我的问题是,当我单击按钮时,window.open 功能正常工作并显示一个弹出窗口,但在此之后,页面无法重定向到定义位置:
<script type="text/javascript">
var win=null;
$(document).ready(function() {
$("#buttonid").live("click",function(){
var alt = "http://www.testhost.com/test.php";
var rel = "http://www.testhost.com/test2.php";
var width= (window.innerWidth)-450;
var win = window.open(alt,"mywin","width=450,height="+window.innerHeight+",left="+width+", location=no, menubar=no, status=no, titlebar=no, scrollbars=no");
win.onload=function(){
window.location=rel;
}
win.blur();
//setTimeout(win.focus(), 0);
return false;
});
});
</script>
</head>
<body>
<button id="buttonid">Click</button>
</body>