Javascript: 关闭弹出窗口,打开新窗口并重定向

我想关闭当前的弹出窗口,打开一个新窗口 /标签/ 并重定向到特定的链接。 它对我的链接非常容易。
<a>

. 我只是在添加

" target="_blank""

, 它工作得很好 /它实际上并不关闭弹出窗口,但最小化它,它也很好/.

因为我使用带有功能的一些按钮 onclick, 我想以某种方式植入按钮 "target="_blank""... 在按钮看起来像这样的那一刻:


<input onclick="parent.window.opener.location='http://google.com'; window.close//;" type="button"/>


它有效,但问题是它在父窗口中重定向,并没有打开新窗口......

在 Any1 有一个想法如何获得功能 "target="_blank"", 按下按钮一个新窗口,而不是重定向而不是重定向父窗口?
</a>
已邀请:

帅驴

赞同来自:

为什么不只是在你的身上使用它 onclick:


<input onclick="window.open/'http://google.com'/; window.close//;" type="button">


</input>

董宝中

赞同来自:

$/'#button'/.click/function/e/
{
e.preventDefault//;
window.open/'http://www.facebook.com/','_blank'/;
}/;

<input id="button" type="button" value="Go facebook"/>


它适用于数字 IExplorer, Firefox, Chrome, Opera 和 Safari

江南孤鹜

赞同来自:

代码 jQuery:


$/function//{
$/'#button'/.click/function// {
window.close//;
window.open/'http://www.google.com/'/;
}/;
}/;


代码 HTML:


<input id="button" type="button" value="click me"/>


他工作 OK 在 Chrome 和 IE. 在 Firefox 您必须使用此代码打开此代码
window.open

.

帅驴

赞同来自:

试试吧:


<a href="[url=http://google.com"]http://google.com"[/url] onclick="window.close//;" target="_blank">LINK</a>

要回复问题请先登录注册