导航首页 » 技术教程 » css 兼容性问题this.style.cursor=\'\'hand\'\'
css 兼容性问题this.style.cursor=\'\'hand\'\' 70 2024-03-31   

作者:洛科
先看这一句

<a href='http://www.gimoo.net/t/1404/5416662142664.html' onmouseover="this.style.cursor='hand'" onmouseout="this.style.cursor='default'" onclick="document.getElementById('ShowContent').innerHTML='';return false;">
<img alt="清空屏幕" src="http://www.gimoo.net/t/1404/UI/clear.gif" style="border:0"/>
</a>

在IE下是没问题的,当鼠标划过去时,会出现一个小手的形状,但是在FF中,只有第一次划过去才有效,这个有效是因为有锚记A的存在,而不是onmouseover起作用的结果。
网上找了很多,都说只要让this.style.cursor='hand'改成this.style.cursor='pointer'就可以了,但是在FF中鼠标划过去时只有第一次会出现小手。
其实在FF下面要达到在IE中一样的效果也是可以的。我们的办法就是使用CSS HACK(难道我为CSS HACK又增添了这一条 哈哈?)

<a href='http://www.gimoo.net/t/1404/5416662142664.html' onmouseover="this.style.cursor='pointer';this.style.cursor='hand'" onmouseout="this.style.cursor='default'" onclick="document.getElementById('ShowContent').innerHTML='';return false;">
<img alt="清空屏幕" src="http://www.gimoo.net/t/1404/UI/clear.gif" style="border:0"/>
</a>

在IE7和FF3.0.3中测试通过。


!!!站长长期在线接!!!

网站、小程序:定制开发/二次开发/仿制开发等

各种疑难杂症解决/定制接口/定制采集等

站长微信:lxwl520520

站长QQ:1737366103