IE 7 CTRL +点击打开一个新窗口 - 如何压制它? [英] IE 7 CTRL + click opens a new window - how to suppress it?

查看:130
本文介绍了IE 7 CTRL +点击打开一个新窗口 - 如何压制它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

CTRL +点击链接时,是否可以禁止默认的IE 7功能打开一个新窗口?如果是,如何?

Is it possible to suppress the default IE 7 functionality when CTRL+click on link opens a new window? if so, how?

谢谢!

推荐答案

方法来抑制 Ctrl +在Internet Explorer中点击没有子元素的链接 - onclick 事件根本不会触发链接点击 Ctrl 键。看来,Microsoft不希望您更改此功能,因为您可能会混淆用户。

There is no way to suppress a Ctrl + Click on a link with no child elements in Internet Explorer -- the onclick event doesn't fire at all for link clicks if the Ctrl key is held down. It seems that Microsoft don't want you to change this functionality out of fear that you might confuse the user.

我在发布之前搜索过某种官方确认/解释这个答案,但不幸的是这个限制没有列在MSDN和谷歌的文档没有帮助。然而,它仍然是真的,自己尝试一下:

I searched for some sort of official confirmation/explanation before posting this answer, but unfortunately this limitation is not listed in the documentation on MSDN and Google wasn't helpful. Nevertheless, it remains true, try it yourself:

<a href="#" onclick="alert('Hello');">Hello</a>

你会发现 Ctrl +点击链接不会警报框。根据 pinkgothic ,为链接分配子元素将解决问题。例如:

You will find that a Ctrl + click on the link will not throw the alert box. According to pinkgothic, assigning a child element to the link will work around the problem. For example:

<a href="#" onclick="alert('Hello');"><span>Hello</span></a>

这样做是因为< span> 元素,然后传播到< a> 元素。

This works because the click is triggered for the <span> element first, before propagating to the <a> element.

这篇关于IE 7 CTRL +点击打开一个新窗口 - 如何压制它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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