在IE瀏覽環境,W3C發佈網頁滑鼠游標的標準寫法說明:
<style type="text/css"><!--
body {cursor:url("mything.cur"),url("mything.cur"),text;}
-->
</style>
當無法處理游標名單的第一個游標,則會以第二個游標代替
若無法處理任何定義的游標,最後便以一般游標text顯示(一般游標樣式如下)
游標樣式一覽:
- 文字I型 text
- 十字型 crosshair
- 箭頭朝下 s-resize
- 十字箭頭 move
- 箭頭朝右 e-resize
- 加一問號 help
- 箭頭朝左 w-resize
- 箭頭朝上 n-resize
- 箭頭朝右上 ne-resize
- 箭頭朝左上 nw-resize
- 箭頭斜右下 se-resize
- 箭頭斜左下 sw-resize
- 漏斗 wait
網頁游標其他標籤元素CSS,寫法為:
body {cursor:url("mything.cur"),text;} 整個網頁
table {cursor:url("mything.cur"),text;} 表格
input {cursor:url("mything.cur"),text;} 單行文字表單
a {cursor:url("mything.cur"),text;} 超連結
自由變更網頁游標
複製語法貼於<head></head>之間<script type="text/javascript">
<!--
function changeCursor(theType)
{
document.all("myCursor").style.cursor = theType;
}
// -->
</script>
複製語法貼於body框框內
ID="myCursor"
複製語法貼於<body></body>之間
按下圖片改變滑鼠游標
<img border="0" src="1.gif" onClick="changeCursor('cur_s1.ani')">
<img border="0" src="2.gif" onClick="changeCursor('cur_s2.ani')">