cursor版本:CSS2 兼容性:IE4.0+ NS6.0+ 继承性:有
语法:
cursor : auto | all-scroll | col-resize| crosshair | default | hand | move | help | no-drop | not-allowed | pointer | progress | row-resize | text | vertical-text | wait | *-resize | url ( url )
取值:
auto | : | 默认值。浏览器根据当前情况自动确定鼠标光标类型。 | |
all-scroll | : | IE6.0 | 有上下左右四个箭头,中间有一个圆点的光标。用于标示页面可以向上下左右任何方向滚动。 |
col-resize | : | IE6.0 | 有左右两个箭头,中间由竖线分隔开的光标。用于标示项目或标题栏可以被水平改变尺寸。 |
crosshair | : | 简单的十字线光标。 | |
default | : | 客户端平台的默认光标。通常是一个箭头。 | |
hand | : | 竖起一只手指的手形光标。就像通常用户将光标移到超链接上时那样。 | |
move | : | 十字箭头光标。用于标示对象可被移动。 | |
help | : | 带有问号标记的箭头。用于标示有帮助信息存在。 | |
no-drop | : | IE6.0 | 带有一个被斜线贯穿的圆圈的手形光标。用于标示被拖起的对象不允许在光标的当前位置被放下。 |
not-allowed | : | IE6.0 | 禁止标记(一个被斜线贯穿的圆圈)光标。用于标示请求的操作不允许被执行。 |
pointer | : | IE6.0 | 和 hand 一样。竖起一只手指的手形光标。就像通常用户将光标移到超链接上时那样。 |
progress | : | IE6.0 | 带有沙漏标记的箭头光标。用于标示一个进程正在后台运行。 |
row-resize | : | IE6.0 | 有上下两个箭头,中间由横线分隔开的光标。用于标示项目或标题栏可以被垂直改变尺寸。 |
text | : | 用于标示可编辑的水平文本的光标。通常是大写字母 I 的形状。 | |
vertical-text | : | IE6.0 | 用于标示可编辑的垂直文本的光标。通常是大写字母 I 旋转90度的形状。 |
wait | : | 用于标示程序忙用户需要等待的光标。通常是沙漏或手表的形状。 | |
*-resize | : | 用于标示对象可被改变尺寸方向的箭头光标。w-resize | s-resize | n-resize | e-resize | ne-resize | sw-resize | se-resize | nw-resize | |
url ( url ) | : | IE6.0 | 用户自定义光标。使用绝对或相对 url 地址指定光标文件(后缀为 .cur 或者 .ani )。 |
说明:
设置或检索在对象上移动的鼠标指针采用的光标形状。
此属性的值可以是多个,其间用逗号分隔。假如第一个值不可以被客户端系统理解或所指定的光标无法找到及显示,则第二个值将被尝试使用。依此类推。假如全部值都不可用的话,则此属性不会发生作用。光标不会被改变。
此属性对于 currentStyle 对象而言是只读的。对于其他对象而言是可读写的。
对应的脚本特性为 cursor 。
此属性的值可以是多个,其间用逗号分隔。假如第一个值不可以被客户端系统理解或所指定的光标无法找到及显示,则第二个值将被尝试使用。依此类推。假如全部值都不可用的话,则此属性不会发生作用。光标不会被改变。
此属性对于 currentStyle 对象而言是只读的。对于其他对象而言是可读写的。
对应的脚本特性为 cursor 。
示例:
p { cursor: text; }
a { cursor: pointer; }
body { cursor: url("mycursor.gif"), url("images/cursors/footcursor.jpg"), default; }
a { cursor: pointer; }
body { cursor: url("mycursor.gif"), url("images/cursors/footcursor.jpg"), default; }
应用于:
IE4.0+ | AADDRESSAPPLETBBIGBLOCKQUOTEBODYCAPTIONCENTERCITECODECOLCOLGROUPDDDFNDIRDIVDLDTEMEMBEDFIELDSETFORMHnHRHTMLIIFRAMEIMGINPUT type=buttonINPUT type=checkboxINPUT type=fileINPUT type=imageINPUT type=passwordINPUT type=radioINPUT type=resetINPUT type=submitINPUT type=textKBDLABELLEGENDLILISTINGMARQUEEMENUOBJECTOLPPLAINTEXTPRESSAMPSMALLSPANSTRIKESTRONGstyleSUBSUPTABLETBODYTDTEXTAREATFOOTTHTHEADTRTTUULVARXMP |
IE5.0+ | currentStyleCUSTOMruntimeStyle |
IE5.5+ | defaults |
<style>
#idTable{width:100%;border:0px;background-color:#000000;}
#idTable td{background-color:honeydew;}
#idDIV{width:80%;height:40px;background-color:#FF6633;color:#FFFFFF;padding:4px;}
</style>
<script>
function rdl_change(e){
event.cancelBubble=true;
if (event.srcElement.tagName.toLowerCase()!="td") return;
with (event.srcElement) try {style.cursor=innerText;style.backgroundColor="lightyellow";onmouseout=new Function("this.style.backgroundColor='honeydew'");} catch(e){}
}
</script>
<table border=0 id=idTable cellpadding=3 cellspacing=1 onmouseover="rdl_change()"><tr>
<td>auto</td><td>all-scroll</td><td>col-resize</td><td>crosshair</td>
</tr><tr>
<td>move</td><td>help</td><td>no-drop</td><td>not-allowed</td>
</tr><tr>
<td>row-resize</td><td>text</td><td>vertical-text</td><td>wait</td>
</tr><tr>
<td>hand</td><td>progress</td><td>s-resize</td><td>se-resize</td>
</tr><tr>
<td>default</td><td>pointer</td><td>w-resize</td><td>nw-resize</td>
</tr><tr>
<td>n-resize</td><td>e-resize</td><td>ne-resize</td><td>sw-resize</td>
</tr><tr>
<td colspan=2>url(images/rdl_tnt.ani)</td><td colspan=2>url(images/rdl_cross.cur)</td>
</tr></table>
<br>
<div id=idCodeDiv>请将鼠标移动到上方的表格中察看光标样式。</div>
#idTable{width:100%;border:0px;background-color:#000000;}
#idTable td{background-color:honeydew;}
#idDIV{width:80%;height:40px;background-color:#FF6633;color:#FFFFFF;padding:4px;}
</style>
<script>
function rdl_change(e){
event.cancelBubble=true;
if (event.srcElement.tagName.toLowerCase()!="td") return;
with (event.srcElement) try {style.cursor=innerText;style.backgroundColor="lightyellow";onmouseout=new Function("this.style.backgroundColor='honeydew'");} catch(e){}
}
</script>
<table border=0 id=idTable cellpadding=3 cellspacing=1 onmouseover="rdl_change()"><tr>
<td>auto</td><td>all-scroll</td><td>col-resize</td><td>crosshair</td>
</tr><tr>
<td>move</td><td>help</td><td>no-drop</td><td>not-allowed</td>
</tr><tr>
<td>row-resize</td><td>text</td><td>vertical-text</td><td>wait</td>
</tr><tr>
<td>hand</td><td>progress</td><td>s-resize</td><td>se-resize</td>
</tr><tr>
<td>default</td><td>pointer</td><td>w-resize</td><td>nw-resize</td>
</tr><tr>
<td>n-resize</td><td>e-resize</td><td>ne-resize</td><td>sw-resize</td>
</tr><tr>
<td colspan=2>url(images/rdl_tnt.ani)</td><td colspan=2>url(images/rdl_cross.cur)</td>
</tr></table>
<br>
<div id=idCodeDiv>请将鼠标移动到上方的表格中察看光标样式。</div>