Is it possible to suppress the default IE 7 functionality when CTRL+click on link opens a new window? if so, how?
Thanks!
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 上的文档中未列出此限制,并且 Google 没有帮助。尽管如此,它仍然是正确的,你自己尝试一下:
<a href="#" onclick="alert('Hello');">Hello</a>
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>
元素。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)