W3C home > Mailing lists > Public > public-html-ig-zh@w3.org > May 2011

Re: 如何使用JavaScript判断用户按下了左边的Ctrl键还是右边的Ctrl键?

From: Jinjiang Zhao <zhaojinjiang@yahoo.com.cn>
Date: Fri, 27 May 2011 15:28:54 +0800
Message-ID: <A0B6F3969BAB42A49F22A70D0A3AA610@JinjiangZhaoPC>
To: "John Hax" <johnhax@gmail.com>
Cc: <public-html-ig-zh@w3.org>
哦,原来如此
我会认真研习一下DOM Level 3 Events,多谢指教

Jinks Zhao | 勾三股四

zhaojinjiang@yahoo.com.cn
http://weibo.com/mx006


From: John Hax
Sent: Friday, May 27, 2011 3:17 PM
To: Jinjiang Zhao
Cc: public-html-ig-zh@w3.org
Subject: Re: 如何使用JavaScript判断用户按下了左边的Ctrl键还是右边的Ctrl键?

新的DOM Level 3 Events草案里可以解决这个问题。

KeyboardEvent上会有 location属性,指明按键来源。包括:left、right(对于像ctrl那样有左右两边的按键),还有mobile(移动设备如手机上的按键)、joystick(游戏手柄上的按键)等。


2011/5/25 Jinjiang Zhao <zhaojinjiang@yahoo.com.cn>
如题,想区分一下左右Ctrl键的键盘事件,想不出合适的办法,stackoverflow也有人问类似的问题:
http://stackoverflow.com/questions/4404899/can-you-distinguish-between-the-left-ctrl-key-and-right-ctrl-key-using-keycodes-i

想问问诸位有没有好的办法或技巧可以判断左右Ctrl键,另外标准中为何在定义keyCode的时候不为左右Ctrl设计不同的值呢?

Jinks Zhao | maxthon | Front-end Manager
Received on Friday, 27 May 2011 07:31:17 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:43:48 UTC