js設置鼠標光標形狀
時間:
迪豪910由 分享
js設置鼠標光標形狀
鼠標的形狀各種各樣,有不同的樣式,你知道怎么在js上設置嗎?不知道的話,跟著學習啦小編一起學習吧。
js 設置鼠標光標形狀
| auto(default) | 默認值。瀏覽器根據當前情況自動確定鼠標光標類型。 |
| col-resize | 有左右兩個箭頭,中間由豎線分隔開的光標。用于標示項目或標題欄可以被水平改變尺寸。 |
| crosshair | 簡單的十字線光標。 |
| all-scroll | 有上下左右四個箭頭,中間有一個圓點的光標。用于標示頁面可以向上下左右任何方向滾動。 |
| move | 十字箭頭光標。用于標示對象可被移動。 |
| help | 帶有問號標記的箭頭。用于標示有幫助信息存在。 |
| no-drop | 帶有一個被斜線貫穿的圓圈的手形光標。用于標示被拖起的對象不允許在光標的當前位置被放下。 |
| not-allowed | 禁止標記(一個被斜線貫穿的圓圈)光標。用于標示請求的操作不允許被執行。 |
| pointer(hand) | 豎起一只手指的手形光標。就像通常用戶將光標移到超鏈接上時那樣。 |
| progress | 帶有沙漏標記的箭頭光標。用于標示一個進程正在后臺運行。 |
| row-resize | 有上下兩個箭頭,中間由橫線分隔開的光標。用于標示項目或標題欄可以被垂直改變尺寸。 |
| text | 用于標示可編輯的水平文本的光標。通常是大寫字母 I 的形狀。 |
| vertical-text | 用于標示可編輯的垂直文本的光標。通常是大寫字母 I 旋轉90度的形狀。 |
| wait | 用于標示程序忙用戶需要等待的光標。通常是沙漏或手表的形狀。 |
| *-resize | 用于標示對象可被改變尺寸方向的箭頭光標。 w-resize | s-resize | n-resize | e-resize | ne-resize | sw-resize | se-resize | nw-resize |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>js 光標設置</title></head><body><input type="button" value="auto" onclick=SetCursor("auto") /> <input type="button" value="col-resize" onclick=SetCursor("col-resize") /> <input type="button" value="row-resize" onclick=SetCursor("row-resize") /> <input type="button" value="all-scroll" onclick=SetCursor("all-scroll") /> <input type="button" value="crosshair" onclick=SetCursor("crosshair") /> <input type="button" value="move" onclick=SetCursor("move") /> <input type="button" value="help" onclick=SetCursor("help") /> <input type="button" value="no-drop" onclick=SetCursor("no-drop") /> <input type="button" value="not-allowed" onclick=SetCursor("not-allowed") /><input type="button" value="pointer" onclick=SetCursor("pointer") /> <input type="button" value="progress" onclick=SetCursor("progress") /> <input type="button" value="text" onclick=SetCursor("text") /> <input type="button" value="vertical-text" onclick=SetCursor("vertical-text") /> <input type="button" value="wait" onclick=SetCursor("wait") /> <input type="button" value="w-resize" onclick=SetCursor("w-resize") /> <div id="test" style="width:600px; height:200px; margin: 0 auto; background-color: blue; color:#FFF;">移動鼠標到此查看效果</div> </body><script language="Javascript"> function SetCursor(str){ document.getElementById('test').style.cursor=str;} </script></html> |
