锚点目标的空白 - 如何总是打开同一弹出窗口 [英] anchor target blank - how to always open in same popup window

查看:88
本文介绍了锚点目标的空白 - 如何总是打开同一弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我公司拥有一批在页面锚。我想,当用户点击一个锚,将打开一个空白窗口。我已经使用的目标='_空白,并且工作正常。不过,我想,如果用户点击在原有页面另一个链接,我想,它使用的是打开的第一个窗口相同的弹出窗口。我不希望是用户像10弹出结束了,因为这将是一个有点凌乱的用户。

这是可以实现的吗?

I have a number of anchors in a page. I want that when the user clicks on an anchor it would open a blank window. I have used target='_blank' and that works correctly. However, I want that if the user clicks on another link in the original page, I would like that it uses the same popup that was opened for the first window. What I do not want is that the user ends up with like 10 popups as this would be a bit messy for the user.
Is this achievable please?


任何援助将greately AP preciated。


Any assistance would be greately appreciated.

推荐答案

目标是德$ P $,因为HTML 4.01 pcated,但是,您可以用JS这样的:

target is deprecated since HTML 4.01, you can however use JS like this:

<a href="http://example.com" id="clicky">test</a>
<script>
var clicky = document.getElementById("clicky");

clicky.onclick = function(){
    window.open(clicky.href, "test");    
    return false;        
}​
</script>

window.open ,第一个属性是链接应该去URL,第二个是窗口的名称,单击像这样的意愿,任何一个环节的设置在同一个窗口中打开。

in the window.open, the first attribute is the URL the link should go to, the second is the name of the window, clicking any link setup like this will open in the same window.

还有更好,更容易的方法来做到这与jQuery等多种元素,但是这一切取决于在 window.open

there's better and easier ways to do this to multiple elements with jquery etc. but it all hinges on the window.open.

这篇关于锚点目标的空白 - 如何总是打开同一弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆