2007年4月3日 星期二

滑鼠游標

工作需要,要在網頁更改游標的圖示...
剛巧找到這一頁教學,寫的蠻詳細的~

OECSPACE Cursor「滑鼠游標教學與下載」

節錄我所需用到程式部份

在IE瀏覽環境,W3C發佈網頁滑鼠游標的標準寫法說明:

<style type="text/css">
<!--
body {cursor:url("mything.cur"),url("mything.cur"),text;}
//-->
</style>
當無法處理游標名單的第一個游標,則會以第二個游標代替若無法處理任何定義的游標,最後便以一般游標text顯示


網頁游標其他標籤元素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')">

沒有留言: