Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/89.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 将焦点保留在弹出窗口上_Javascript_Html - Fatal编程技术网

Javascript 将焦点保留在弹出窗口上

Javascript 将焦点保留在弹出窗口上,javascript,html,Javascript,Html,我在“主页”上有一个按钮,打开一个弹出窗口,其中包含几个向前的链接 当有人点击其中一个向前链接时,链接页面会在一个新的单独窗口中打开,留下“主页”仍然打开,弹出窗口“模糊”(我认为这是正确的词,意思是弹出窗口没有关闭,但消失在“主页”后面) 我希望弹出窗口保持“焦点”(在“主页”顶部),直到用户单击弹出窗口底部的“关闭此窗口” 这是生成弹出窗口的JavaScript: function OpenPop() { var windowcontents = "https://example.

我在“主页”上有一个按钮,打开一个弹出窗口,其中包含几个向前的链接

当有人点击其中一个向前链接时,链接页面会在一个新的单独窗口中打开,留下“主页”仍然打开,弹出窗口“模糊”(我认为这是正确的词,意思是弹出窗口没有关闭,但消失在“主页”后面)

我希望弹出窗口保持“焦点”(在“主页”顶部),直到用户单击弹出窗口底部的“关闭此窗口”

这是生成弹出窗口的JavaScript:

function OpenPop() 
{
    var windowcontents = "https://example.com/link.html";
    var win = window.open(windowcontents,"remote",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width=450,height=425');
    win.creator=self;
    myWindow.focus();
}

这是“主页”上的HTML,显示打开弹出窗口的按钮

 <p class="center"><a href="javascript:OpenPop();">
                  <img src="https://www.example.com/images/link.gif" alt="Links"
                    width="130" border="0" height="51"></a></p>
<a href="javascript:self.close()"><img src="images/close.gif" alt="Click here to close this
          window" width="102" height="9"> </a>  

下面是弹出窗口底部的“关闭此窗口”代码

 <p class="center"><a href="javascript:OpenPop();">
                  <img src="https://www.example.com/images/link.gif" alt="Links"
                    width="130" border="0" height="51"></a></p>
<a href="javascript:self.close()"><img src="images/close.gif" alt="Click here to close this
          window" width="102" height="9"> </a>  

有没有办法让弹出窗口保持“焦点”?
谢谢。

为什么不使用真正的popover?喜欢,谢谢。我以前从未听说过“popover”,现在我正在w3schools.com上自学它是什么,以及如何使用它