空白链接在同一窗口中打开 - 为什么以及如何解决? [英] Blank links opens in the same window - Why, and how to fix it?

查看:96
本文介绍了空白链接在同一窗口中打开 - 为什么以及如何解决?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有四个链接:

 < a href =http://google.comtarget =_ blank >谷歌< / A> 
< a href =http://bing.comtarget =_ blank>必应< / a>
< a href =http://yahoo.comtarget =_ blank>雅虎< / a>
< a href =http://wikipedia.comtarget =_ blank> wiki< / a>

当我点击一个链接时,它会在新窗口中打开。
点击另一个链接后,它会在上次打开的同一个窗口中打开。



这对我不好,我想打开一个空白页窗口,无论打开的窗口如何。



我该如何处理? (我不在乎双击谷歌链接打开它两次,没关系。)



这是有效的,只是它必须。

>

EXCUSE ME,与我的PHP野兽沟通问题。 所以,实际上链接是例如:

 < a href =javascript :; onclick =window.open('http://google.com','Admin');> gaagle< / a> 
< a href =javascript :; onclick =window.open('http://bing.com','Admin');> bang< / a>
< a href =javascript :; onclick =window.open('http://yahoo.com','Admin');> yahuu!< / a>

现在,所有的东西都打开到同一个窗口,因为名称标签(第二个参数window.open) - .-由于所有打开的窗口的ID是管理员,所有其他窗口在该窗口上打开。我没有检查它,请原谅我浪费你的时间。 解决方案

如果你给每个链接一个不同的目标,在不同的标签页/窗口中。

 < a href =http://google.comtarget =googleWindow> ;谷歌< / A> 
< a href =http://bing.comtarget =bingWindow>必应< / a>
< a href =http://wikipedia.comtarget =wikiWindow> wiki< / a>

如果您在链接上再次单击,它将重新使用现有窗口(如果它是如果你使用 target =_ blank,每一次点击都应该在一个新的标签页/窗口中,无论以前的点击次数如何。如果你没有得到这种行为,你使用的浏览器是什么?



如果你希望所有的点击都转到相同的窗口使用...

 < a href =http://google.comtarget =myWindow> Google< / a> 
< a href =http://bing.comtarget =myWindow>必应< / a>
< a href =http://wikipedia.comtarget =myWindow> wiki< / a>


I have four links:

<a href="http://google.com" target="_blank">Google</a>
<a href="http://bing.com" target="_blank">Bing</a>
<a href="http://yahoo.com" target="_blank">Yahoo</a>
<a href="http://wikipedia.com" target="_blank">wiki</a>

When I click on a link, it will opens in a new window. And on click to another link, it will opens in the same window opened last time.

It is not good for me, I want to open a blank window on every single click, regardless of the opened windows.

How can I handle this? (I don't care about double-click Google link opens it twice, doesn't matter.)

And this is works, just it have to.

EXCUSE ME, communication problem with my PHP beast.

So, actually the links are like:

<a href="javascript:;" onclick = "window.open('http://google.com','Admin');">gaagle</a>
<a href="javascript:;" onclick = "window.open('http://bing.com','Admin');">bang</a>
<a href="javascript:;" onclick = "window.open('http://yahoo.com','Admin');">yahuu!</a>

And now, all the stuffs opens to the same window, because of the name tag (2nd param of window.open) -.- And since all the opened window's ID was Admin, every other windows opened on that window. I did not checked it, excuse me for wasting your time.

解决方案

If you give each link a different target, they will open in different tabs / windows.

<a href="http://google.com" target="googleWindow">Google</a>
<a href="http://bing.com" target="bingWindow">Bing</a>
<a href="http://yahoo.com" target="yahooWindow">Yahoo</a>
<a href="http://wikipedia.com" target="wikiWindow">wiki</a>

If you click a second time on a link, it will re-use the existing window if it is still available.

If you use target="_blank" every click should be in a new tab / window, regardless of previous clicks. If you aren't getting this behaviour, what browser are you using?

If you want all clicks to goto the same window use...

<a href="http://google.com" target="myWindow">Google</a>
<a href="http://bing.com" target="myWindow">Bing</a>
<a href="http://yahoo.com" target="myWindow">Yahoo</a>
<a href="http://wikipedia.com" target="myWindow">wiki</a>

这篇关于空白链接在同一窗口中打开 - 为什么以及如何解决?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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