[英]Target=Blank link with OnClick JavaScript
Why the TARGET _BLANK parameter does not work, when there is onClick parameter? 当存在onClick参数时,为什么TARGET _BLANK参数不起作用? The onlick is google event script.
该onlick是google事件脚本。 When I add onclick to this link, it opens inside the frameset.
当我在该链接上添加onclick时,它将在框架集中打开。
<a target=_blank href="externalwwwlink" onClick="recordOutboundLink(this, 'Link', 'aaa');return false;">OPEN </a>
You return false
here: 您在这里返回
false
:
onClick="recordOutboundLink(this, 'Link', 'aaa'); return false;"
so it prevents usual behaviour (bubling of click event). 因此它可以防止出现通常的行为(点击事件冒泡)。 It is very common way to prevent standard action (redirecting by reference, or submitting a form).
防止标准操作(通过引用重定向或提交表格)的非常常见的方法。
Your onClick
handler has a return false
at the end, which is an old way of telling the browser to stop handling the click . 您的
onClick
处理程序结尾处会return false
,这是一种告诉浏览器停止处理 click的旧方法 。 The browser will not open the link, and in your case, not open the href in a new (blank) window/tab. 浏览器将不会打开链接,在您而言,不会在新的(空白)窗口/标签中打开href。
Remove the return false;
删除
return false;
at the end of the onClick so the browser knows it can go on. 在onClick的末尾,以便浏览器知道它可以继续。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.