简体   繁体   English

Lazyweb:IE7 如何在带有文本的 li 元素上执行 onMouseOver Javascript 有什么有趣的地方吗?

[英]Lazyweb: Is there something funny about how IE7 does onMouseOver Javascript on li elements with text?

I'm an Ubuntu user, so I'm not knowledgeable of Internet Explorer.我是 Ubuntu 用户,所以我不了解 Internet Explorer。 We have a Javascript based drop down menu thingie using li's and ul's and all that.我们有一个基于 Javascript 的下拉菜单,使用 li 和 ul 等等。 It works fine in Firefox and IE6.它在 Firefox 和 IE6 中运行良好。 However not in IE7.然而不是在 IE7 中。 It looks like IE7 doesn't call the onMouseOver function unless you go over the text in the middle, as opposed to the blank area between the text and the edge of the li element (which is what IE6 does).看起来 IE7 不会调用onMouseOver函数,除非您遍历中间的文本,而不是文本和 li 元素边缘之间的空白区域(这是 IE6 所做的)。 Any hints on this?这有什么提示吗?

UPDATE 21st May 2009 - I'm not sure what's going on here, but I've solved my problem another way. 2009 年 5 月 21 日更新 - 我不确定这里发生了什么,但我已经用另一种方式解决了我的问题。

尝试向元素添加 display:block ,使其“扩展”到父元素的宽度,而不仅仅是元素的 textNode 的宽度。

First off, you really should check out IES4Linux: http://www.tatanka.com.br/ies4linux/page/Main_Page首先,你真的应该看看 IES4Linux: http ://www.tatanka.com.br/ies4linux/page/Main_Page

It makes web development on Linux significantly easier (although it's not a "true" IE; for that you'd need a virtual machine, Windows install, and all the hassle that entails ... but IEs4Linux is a very good approximation).它使 Linux 上的 Web 开发变得更加容易(尽管它不是“真正的”IE;为此,您需要一个虚拟机、Windows 安装以及所有相关的麻烦……但 IEs4Linux 是一个非常好的近似值)。

Secondly, you should really read: http://www.satzansatz.de/cssd/onhavinglayout.html其次,你应该真正阅读: http : //www.satzansatz.de/cssd/onhavelayout.html

That page has a very nice explanation of IE layout issues, and how to get around them (display:block, as Jack suggested, is one approach, but it may create other issues for you, as that page explains).该页面对 IE 布局问题以及如何解决这些问题有很好的解释(如 Jack 建议的那样,display:block 是一种方法,但正如该页面所解释的那样,它可能会给您带来其他问题)。

Good luck.祝你好运。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM