当前位置: 首页 > 图文教程 > 网页制作 > CSS样式表 > css 兼容性问题this.style.cursor=''''hand''''

CSS样式表
网页设计布局基础
Lesson01_01 HTML基础
HTML的全局架构标签
Lesson01_03 注释与特殊字符
Lesson01_04 格式标签与文本标签
Lesson01_05 HTML中的超链接
Lesson01_07 图像标签
Lesson02_01 表格标签
Lesson02_02 帧标签
Lesson02_03 表单标签
Lesson02_04 表单标签(2)
Lesson02_05 头元素
Lesson02_06 分区标签
Lesson03_02 样式规则选择器
学习标准——笔记
用好href的target属性
常用CSS集合
教你如何用CSS来控制网页字体的显示样式
用CSS解决中英文混合字符串的截取省略问题的解决办法
鼠标移动到超链接上的效果

CSS样式表 中的 css 兼容性问题this.style.cursor=''''hand''''


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-10-12   浏览: 405 ::
收藏到网摘: n/a

css 兼容性问题this.style.cursor='hand'让我们来CSS HACK 作者:洛科
先看这一句
复制代码 代码如下:

<a href='#' onmouseover="this.style.cursor='hand'" onmouseout="this.style.cursor='default'" onclick="document.getElementById('ShowContent').innerHTML='';return false;">
<img alt="清空屏幕" src="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='#' onmouseover="this.style.cursor='pointer';this.style.cursor='hand'" onmouseout="this.style.cursor='default'" onclick="document.getElementById('ShowContent').innerHTML='';return false;">
<img alt="清空屏幕" src="UI/clear.gif" style="border:0"/>
</a>

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