网页中的event 事件怎样截获呢?本人没分了(5)

wwle 2003-10-16 10:37:12

我不太清楚event 是什么意思(html),向鼠标右键 ,右键弹菜单,
总值在DHtml中有一个 event 什么动动,不明白。
...全文
32 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
wwle 2003-10-16
  • 打赏
  • 举报
回复
乖乖全english , let me investigate
kingdomzhf 2003-10-16
  • 打赏
  • 举报
回复
event Object

--------------------------------------------------------------------------------

Represents the state of an event, such as the element in which the event occurred, the state of the keyboard keys, the location of the mouse, and the state of the mouse buttons.

Remarks

The event object is available only during an event梩hat is, you can use it in event handlers but not in other code.

Although all event properties are available to all event objects, some properties might not have meaningful values during some events. For example, the fromElement and toElement properties are meaningful only when processing the onmouseover and onmouseout events.

In Microsoft?Visual Basic?Scripting Edition (VBScript), you must access the event object through the window object.

This object is available in script as of Microsoft?Internet Explorer 4.0.

event的属性

altKey Sets or retrieves the state of the ALT key.
altLeft Sets or retrieves the state of the left ALT key.
button Retrieves the mouse button pressed by the user.
cancelBubble Sets or retrieves whether the current event should bubble up the hierarchy of event handlers.
clientX Retrieves the x-coordinate of the mouse pointer's position relative to the client area of the window, excluding window decorations and scroll bars.
clientY Retrieves the y-coordinate of the mouse pointer's position relative to the client area of the window, excluding window decorations and scroll bars.
ctrlKey Sets or retrieves the state of the CTRL key.
ctrlLeft Sets or retrieves the state of the left CTRL key.
dataFld Sets or retrieves the data column affected by the oncellchange event.
dataTransfer Provides access to predefined clipboard formats for use in drag-and-drop operations.
fromElement Retrieves the object the mouse pointer is exiting during the onmouseover and onmouseout events.
keyCode Sets or retrieves the Unicode key code associated with the key that caused the event.
offsetX Sets or retrieves the x-coordinate of the mouse pointer's position relative to the object firing the event.
offsetY Sets or retrieves the y-coordinate of the mouse pointer's position relative to the object firing the event.
propertyName Sets or retrieves the name of the property that changes on the event object.
qualifier Sets or retrieves the name of the data member provided by a data source object.
reason Retrieves the result of the data transfer for a data source object.
recordset Retrieves from a data source object a reference to the default record set.
repeat Retrieves whether the onkeydown event is being repeated.
returnValue Sets or retrieves the return value from the event.
saveType Retrieves the clipboard type when oncontentsave fires.
screenX Retrieves the x-coordinate of the mouse pointer's position relative to the user's screen.
screenY Retrieves the y-coordinate of the mouse pointer's position relative to the user's screen.
shiftKey Retrieves the state of the SHIFT key.
shiftLeft Sets or retrieves the state of the left SHIFT key.
srcElement Retrieves the object that fired the event.
srcFilter Retrieves the filter object that caused the onfilterchange event to fire.
srcUrn Retrieves the Uniform Resource Name (URN) of the behavior that fired the event.
toElement Retrieves a reference to the object to which the user is moving the mouse pointer.
type Retrieves the event name from the event object.
x Retrieves the x-coordinate of the mouse pointer's position relative to the parent element.
y Retrieves the y-coordinate of the mouse pointer's position relative to the parent element.

* denotes an extension to the W3C DOM.
event例子

This example uses the event object to check whether the user clicked the mouse within a link, and to prevent the link from being navigated if the SHIFT key is down.

<HTML>
<HEAD><TITLE>Cancels Links</TITLE>
<SCRIPT LANGUAGE="JScript">
function cancelLink() {
if (window.event.srcElement.tagName == "A" && window.event.shiftKey)
window.event.returnValue = false;
}
</SCRIPT>
<BODY onclick="cancelLink()">
This example displays the current mouse position in the browser's status window.

<BODY onmousemove="window.status = 'X=' + window.event.x + ' Y='
+ window.event.y">

61,111

社区成员

发帖
与我相关
我的任务
社区描述
层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现HTML(标准通用标记语言的一个应用)或XML(标准通用标记语言的一个子集)等文件样式的计算机语言。
社区管理员
  • HTML(CSS)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧