我有一个名为myWindow的弹出窗口,当它弹出时,我希望焦点位于原始窗口上,而不是弹出窗口。我拿出myWindow.focus();
这一行,它仍然关注弹出窗口。有没有人知道如何在创建弹出窗口时将注意力集中在原始窗口上?健康长寿·繁荣昌盛。弹出窗口设置焦点
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function openWin()
{
myWindow=window.open('','','width=200,height=100');
myWindow.document.write("<p>This is 'myWindow'</p>");
myWindow.focus();
}
</script>
</head>
<body>
<input type="button" value="Open window" onclick="openWin()" />
</body>
</html>
+1“Live Long and Prosper”。 -1没有绑定你的事件处理程序在JavaScript中。 – jbabey 2012-07-09 14:39:55
查看http://stackoverflow.com/questions/7996252/window-popups-how-to-get-window-blur-or-window-focus-to-work-in-firefox-4 – j08691 2012-07-09 14:41:57
我将不胜感激只是一个+ 1请,因为我是新的这个... :) – 2012-07-09 14:49:46