我点了一个按钮,并在其中放置了一个javascript函数来打开一个新窗口,如果再次单击该按钮,同一个窗口再次刷新并指向它。在firefox和chrome中工作。但不是在IE.Here是我试图焦点功能在ie8中不工作
<button onclick="popitup('http://www.google.com');">click</button>
var newwindow = null;
function popitup(url) {
if ((newwindow == null) || (newwindow.closed)) {
newwindow = window.open(url, 'Buy', 'width=950,height=650,scrollbars=yes,resizable=yes');
newwindow.focus();
} else {
newwindow.location.href = url;
newwindow.focus();
}
}
IE回报newwindow == NULL所有的时间码...这是问题...任何解决办法吗?
这是如何使用C#的? –
默认的按钮行为是'submit',所以试着设置'type ='button'' – Grundy
检查IE是否阻止弹出窗口,也可能重复[在IE9上,Win 7 window.open()返回null而不是引用打开窗口](http://stackoverflow.com/questions/7014242/on-ie9-win-7-window-open-returns-null-instead-of-reference-of-the-opened-wind) – Grundy