跳到内容(1) Cob.com.cn

教程·Javascript 中文手册

您的位置:首页>>教程>>Javascript手册

onKeyDown

Executes JavaScript code when a KeyDown event occurs; that is, when the user depresses a key.

事件适用对象 Navigator 4.0

语法

onKeyDown="handlerText"

参数

handlerText JavaScript 代码或对一个 JavaScript 函数的调用。

使用的事件属性

Contains the list of modifier keys held down when the event occurred.
type 标明了事件的类型。
target 标明了事件原来发送的对象。
layerX, layerY,
pageX, pageY,
screenX, screenY
For an event over a window, these represent the cursor location at the time the event occurred. For an event over a form, they represent the position of the form element.
which Represents the ASCII value of the key pressed. To get the actual letter, number, or symbol of the pressed key, use the

描述

A KeyDown event always occurs before a KeyPress event. If onKeyDown returns false, no KeyPress events occur. This prevents KeyPress events occurring due to the user holding down a key.

参看

onKeyUp 要获得关于事件句柄的常规信息,请看“事件的常规信息”

要获得关于事件对象的信息,请看事件

End Nav