【发布时间】:2017-05-26 00:39:44
【问题描述】:
在 Internet Explorer 中,当我第二次单击该链接时,窗口已经打开,但没有获得焦点。它在 Chrome 和 Firefox 中运行良好。
使用以下代码:
function open_page(url, name, features) {
var win = open(url, (name == null ? 'page' : name), (features == null ? 'menubar=1,toolbar=1,scrollbars=1,width=1024,height=768,resizable=1' : features));
if (win == null) {
alert('Can not open');
} else {
document.isUnloading = false;
win.focus();
}
}
<input type="image" id="pdf" name="pdf" style="padding: 2px; background-color: white; border: 1px dotted white;" title="PDF" src="/images/buttons/pdf.png" alt="PDF" onclick="open_page('http://www.w3schools.com'); return false;" onmouseover="document.getElementById('pdf').style.border='1px solid #a0a0ff'; document.getElementById('pdf').style.backgroundColor='#f0f0ff';"
onmouseout="document.getElementById('pdf').style.border='1px dotted white'; document.getElementById('pdf').style.backgroundColor='white';">
【问题讨论】:
-
你不是唯一一个在问:stackoverflow.com/questions/27898232/… - 我几年前回答过。
标签: javascript html internet-explorer browser frontend