详解JS中event使用方法(1)(3)
11.propertyName
描述:
设置或返回元素的变化了的属性的名称。
语法:
event.propertyName[=sProperty]
可能的值:
sProperty是一个字符串,指定或返回触发事件的元素在事件中变化了的属性的名称。
这个属性是可读写的。无默认值。
注释:
你可以通过使用onpropertychange事件,得到propertyName的值。
例子:
下面的例子通过使用onpropertychange事件,弹出一个对话框,显示propertyName的值。
- <HEAD>
- <SCRIPT>...
- functionchangeProp()...{
- btnProp.value="ThisisthenewVALUE";
- }
- functionchangeCSSProp()...{
- btnStyleProp.style.backgroundColor="aqua";
- }
- </SCRIPT>
- </HEAD>
- <BODY>
- <P>TheeventobjectpropertypropertyNameis
- usedheretoreturnwhichpropertyhasbeen
- altered.</P>
- <INPUTTYPEINPUTTYPE=buttonID=btnProponclick="changeProp()"
- VALUE="ClicktochangetheVALUEpropertyofthisbutton"
- onpropertychange='alert(event.propertyName+"propertyhaschangedvalue")'>
- <INPUTTYPEINPUTTYPE=buttonID=btnStyleProp
- onclick="changeCSSProp()"
- VALUE="ClicktochangetheCSSbackgroundColorpropertyofthisbutton"
- onpropertychange='alert(event.propertyName+"propertyhaschangedvalue")'>
- </BODY>
12.returnValue
描述:
设置或检查从事件中返回的值
语法:
event.returnValue[=Boolean]
可能的值:
true事件中的值被返回
false源对象上事件的默认操作被取消
例子见本文的开头。
13.screenX
描述:
检测鼠标相对于用户屏幕的水平位置
语法:
event.screenX
注释:
这是个只读属性。这意味着,你只能通过它来得到鼠标的当前位置,却不能用它来更改鼠标的位置。
14.screenY
描述:
检测鼠标相对于用户屏幕的垂直位置
语法:
event.screenY
注释:
这是个只读属性。这意味着,你只能通过它来得到鼠标的当前位置,却不能用它来更改鼠标的位置。
15.shiftKey
描述:
检查shift键的状态。
语法:
event.shiftKey
可能的值:
当shift键按下时,值为TRUE,否则为FALSE。只读。






