keycode

What is the KeyCode for “,”(comma) and “.”(dot) in .NET?

我是研究僧i 提交于 2019-11-28 21:14:30
In my KeyDown EventHandler I need to know what is the KeyCode for "," and ".". I can't find them thats why I ask. Thanks! A key and a character are not the same thing. The keyboard layout transforms between them, and that transform isn't trivial. Probably you're doing the wrong thing when using KeyDown . If you want to know which character a user entered you should use KeyPress , which gives the the already translated character. For example Keys.Decimal is a key on the numpad that corresponds to . on the US layout, and , on the German layout. Keys.Oemcomma and OemPeriod are likely , and .

get the value of input text when enter key pressed

一世执手 提交于 2019-11-28 18:41:29
I am trying this: <input type="text" placeholder="some text" class="search" onkeydown="search()"/> <input type="text" placeholder="some text" class="search" onkeydown="search()"/> with some javascript to check whether the enter key is pressed: function search() { if(event.keyCode == 13) { alert("should get the innerHTML or text value here); } } this works fine at the moment, but my question how to get the value inside the text field, I was thinking of passing a reference "this" to the function, or if they had id's then I could use ID's but then I don't see how I could differentiate between

Convert to uppercase as user types using javascript

梦想与她 提交于 2019-11-28 18:36:06
I want to convert lowercase chars to uppercase as the user types using javascript. Any suggestions are welcome. I have tried the following: $("#textbox").live('keypress', function (e) { if (e.which >= 97 && e.which <= 122) { var newKey = e.which - 32; // I have tried setting those e.keyCode = newKey; e.charCode = newKey; } }); $("#textbox").bind('keyup', function (e) { if (e.which >= 97 && e.which <= 122) { var newKey = e.which - 32; // I have tried setting those e.keyCode = newKey; e.charCode = newKey; } $("#textbox").val(($("#textbox").val()).toUpperCase()); }); css #textbox{text-transform

List of hex keyboard scan codes and USB HID keyboard documentation

心不动则不痛 提交于 2019-11-28 18:25:10
Where am I able to find a list of the hex keyboard scan codes for different keyboard layouts? I'm sending the key codes over a (fake) USB HID keyboard with the bash command echo -ne followed by the escaped hex key scan code and the HID device: echo -ne "\x00\x00\x00\x38\x00\x00\x00\x00" > /dev/hidg0 echo -ne "\x00\x00\x00\x00\x00\x00\x00\x00" > /dev/hidg0 for a slash ( / ) on the US keyboard layout. On my keyboard layout (CH) it is echo -ne "\x00\x00\x00\x24\x00\x00\x00\x00" > /dev/hidg0 echo -ne "\x00\x00\x00\x00\x00\x00\x00\x00" > /dev/hidg0 for a slash. So I guess there has to exist a list

Where can I find a list of keyboard keycodes? [closed]

ぃ、小莉子 提交于 2019-11-28 17:47:23
Is there a place where I can find all the keycodes for keys on a keyboard? (For example, the key up may be #114) I can't seem to find one no matter what I search :( Thanks! Here's a list of keycodes that includes a way to look them up interactively. I know this was asked awhile back, but I found a comprehensive list of the virtual keyboard key codes right in MSDN, for use in C/C++. This also includes the mouse events. Note it is different than the javascript key codes (I noticed it around the VK_OEM section). Here's the link: http://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v

How to convert keycode to character using javascript [duplicate]

帅比萌擦擦* 提交于 2019-11-28 16:56:50
问题 This question already has an answer here: Get Character value from KeyCode in JavaScript… then trim 10 answers How to convert keycode to character using javascript var key_code = 65; result should be character = "a"; 回答1: String.fromCharCode() is what you want: The fromCharCode() method converts Unicode values to characters. Syntax String.fromCharCode(n1, n2, ..., nX) 回答2: As seen here: String.fromCharCode((96 <= key && key <= 105) ? key-48 : key) 来源: https://stackoverflow.com/questions

JavaScript move delay and multiple keystrokes

余生长醉 提交于 2019-11-28 10:38:25
Here is my problem: http://testepi.kvalitne.cz/test/ I do not want the delay between a keypress and the movement of the square. I would also like to know how to move diagonally (pressing two keys at same time). My code: $(function(){ document.addEventListener("keydown", move, false); var x = 0; var y = 0; function move(event){ if(event.keyCode==37){ x -= 10; $("#square").css("left", x); } if(event.keyCode==39){ x += 10; $("#square").css("left", x); } if(event.keyCode==38){ y -= 10; $("#square").css("top", y); } if(event.keyCode==40){ y += 10; $("#square").css("top", y); } } }); First, to avoid

event.keyCode not working in Firefox

不打扰是莪最后的温柔 提交于 2019-11-28 10:16:29
I'm having a problem with a Login page I'm developing on ASP.net C#. The form works on IE, but not Firefox. Here's my sample: <%@ Page Language="c#" Inherits="ClubCard.loginClubcard" CodeFile="loginClubcard.aspx.cs" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <html> <head> <title> Acceso Clubcard </title> <meta http-equiv="Page-Enter" content="blendTrans(Duration=0.25)" /> <meta http-equiv="Page-Exit" content="blendTrans(Duration=0.25)" /> <link rel="stylesheet" type="text/css" href="styles.css"> <style> #centered { LEFT: 50%; MARGIN-LEFT: -235px; POSITION: absolute; TOP

vue如何监听键盘事件中的按键?

余生长醉 提交于 2019-11-28 09:44:44
原文地址 背景 在一些搜索框中,我们往往需要监听键盘的按下( onkeydown )或抬起( onkeyup )事件以进行一些操作。在原生js或者jQuery中,我们需要判断 e.keyCode 的值来获取用户所按的键。这样就存在一个问题:我们必须知道某个按键的 keyCode 值才能完成匹配,使用起来十分不便。 keyCode 实际键值 48到57 0到9 65到90 a到z(A到Z) 112到135 F1到F24 8 BackSpace(退格) 9 Tab 13 Enter(回车) 20 Caps_Lock(大写锁定) 32 Space(空格键) 37 Left(左箭头) 38 Up(上箭头) 39 Right(右箭头) 40 Down(下箭头) 参考: JavaScript 获取键盘事件(键盘某个按键被按下) 方案 在Vue中,已经为常用的按键设置了别名,这样我们就无需再去匹配 keyCode ,直接使用别名就能监听按键的事件。 <input @keyup.enter="function"> 别名 实际键值 .delete delete(删除)/BackSpace(退格) .tab Tab .enter Enter(回车) .esc Esc(退出) .space Space(空格键) .left Left(左箭头) .up Up(上箭头) .right Right(右箭头)

keycode is always zero in Chrome for Android

半城伤御伤魂 提交于 2019-11-28 08:03:59
I need to detect the keycode for a custom search box on my website, but the keycode always returns as zero on Chrome for Android (except for backspace, which returns 8). Has anyone else experienced this, and how did you get around it? Our website works on all mobile browsers except Chrome for Android because we can't detect a non-zero keycode or charcode. I'm running Chrome 27.0.1453.90 on Android 4.1.2 Jelly Bean. The problem can be duplicated with something as simple as: alert(event.keyCode); below solution also work for me. might be useful for others also. var getKeyCode = function (str) {