發新話題

css 兼容性問題this.style.cursor='hand'

css 兼容性問題this.style.cursor='hand'

先看這一句
複製內容到剪貼板
代碼:
<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中測試通過。
<div style="cursor:hand">
<img src="$adimg" onmouseover="this.style.cursor='pointer';this.style.cursor='hand'" onmouseout="this.style.cursor='default'"  border="0" onmousedown="FP_openNewWindow('800', '600', true, true, true, true, true, true, 'kkk', /*href*/'$adurl')">
</div>

TOP

發新話題

本站所有圖文均屬網友發表,僅代表作者的觀點與本站無關,如有侵權請通知版主會盡快刪除。