javascript - :focus in IE not working

标签 javascript css internet-explorer focus

我用需要 :focus 伪类的 CSS 创建了一个网站。选择文本框(即具有焦点)时,我会更改“过滤器”和“背景图像”效果。这适用于 Chrome/FF,但似乎不适用于 IE8(如果是 IE,则可能是以前的版本)。我试图寻找答案,并尝试使用 :active - 但那不起作用。有没有办法使用伪类更改“过滤器”等属性?如果做不到这一点,我可以使用 OnClick 事件在 JS 中完成吗?

谢谢

最佳答案

IE 上的伪类:whatever:hover

Most modern browsers support the :hover selector for any html element. This is cool, because it enables you to, for instance, apply a mouseover effect to table rows using only CSS. IE however, has an erratic support for :hover at best, depending on the particular version your visitor is using.

Whatever:hover is a small script that automatically patches :hover, :active and :focus for IE6, IE7 and IE8 quirks, letting you use them like you would in any other browser. Version 3 introduces ajax support, meaning that any html that gets inserted into the document via javascript will also trigger :hover, :active and :focus styles in IE.

http://www.xs4all.nl/~peterned/csshover.html

关于javascript - :focus in IE not working,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2557549/

相关文章:

javascript - emberjs - 测试 - 单击带有链接助手的链接

javascript - MVC 5 Bootstrap 模板 smartadmin - renderbody

javascript - 为什么我在 IE9 中从 flash 调用 Javascript 会失败?

javascript - Internet Explorer 中的 ACE 代码编辑器问题

javascript - 使用 JQuery 从 html5 视频播放器触发事件

php - "invisible"数据 HTML 标签

javascript - 得到一个未定义的返回值,尽管在函数中它不是

html - CSS:固定第一列表? (仅限 CSS!)

css - 覆盖 PrimeNG 的 FileUpload 组件的样式,使其看起来像常规文件上传字段

html - IE显示问题