keycode

javascript subtract(-) keycode

試著忘記壹切 提交于 2019-11-27 14:22:55
ok, i need my code to check if minus/subtract/- was pressed, if it was pressed i want an alert box to pop. i tried with both 109 and 189 key codes but i still don't get the desired result. although i press "-" i don't get that alert box The JavaScript charCodes , which you test for during a keypress event, are ASCII . 109 is the correct keyCode , if used in a keydown or keyup event. "-" has a charCode of 45. Don't do this in a keydown event handler - you put yourself at the mercy of different browsers' ideas about key codes and potential variation between key codes for different keyboard types

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

杀马特。学长 韩版系。学妹 提交于 2019-11-27 13:38:02
问题 In my KeyDown EventHandler I need to know what is the KeyCode for "," and ".". I can't find them thats why I ask. Thanks! 回答1: 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

List of hex keyboard scan codes and USB HID keyboard documentation

安稳与你 提交于 2019-11-27 11:33:00
问题 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

Convert to uppercase as user types using javascript

倖福魔咒の 提交于 2019-11-27 11:30:11
问题 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; } }); 回答1: $("#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

get the value of input text when enter key pressed

孤人 提交于 2019-11-27 11:09:13
问题 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

ASCII码对照表

浪子不回头ぞ 提交于 2019-11-27 10:33:58
ASCII码对照表 字母和数字键的键码值(keyCode) 按键 键码 按键 键码 按键 键码 按键 键码 A 65 J 74 S 83 1 49 B 66 K 75 T 84 2 50 C 67 L 76 U 85 3 51 D 68 M 77 V 86 4 52 E 69 N 78 W 87 5 53 F 70 O 79 X 88 6 54 G 71 P 80 Y 89 7 55 H 72 Q 81 Z 90 8 56 I 73 R 82 0 48 9 57 数字键盘上的键的键码值(keyCode) 功能键键码值(keyCode) 按键 键码 按键 键码 按键 键码 按键 键码 0 96 8 104 F1 112 F7 118 1 97 9 105 F2 113 F8 119 2 98 * 106 F3 114 F9 120 3 99 + 107 F4 115 F10 121 4 100 Enter 108 F5 116 F11 122 5 101 - 109 F6 117 F12 123 6 102 . 110 7 103 / 111 控制键键码值(keyCode) 按键 键码 按键 键码 按键 键码 按键 键码 BackSpace 8 Esc 27 Right Arrow 39 -_ 189 Tab 9 Spacebar 32 Dw Arrow 40 .> 190

C# WinForm快捷键设置技巧

允我心安 提交于 2019-11-27 09:59:14
C# WinForm快捷键设置技巧 1、Alt+*(按钮快捷键) 按钮快捷键也为最常用快捷键,其设置也故为简单。在大家给button、label、menuStrip等其他控件的Text属性指定名称时,在其后面加上‘&'然后在加上一个指定字母即可。如:确定(&D),(Alt+D)调用。 如指定多个字母,则第一个为快捷键。如:确定(&OK),(Alt+O)调用;文件(&Fill),(Alt+F)调用。 2、Ctrl+*及其他组合键 把 Form 的 KeyPreview 属性设为 True 使用Modifiers可设置组合键,键盘数字区按键的Keys枚举以D打头,而小键盘上的数字以NumPad打头。按下Ctrl与Shift组合键的方法与其类似,将Ctrl和Alt的枚举转换为int型相加后与Modifiers对比,这样即可判断是否按下了该组合键。 ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 private void frmMain_KeyDown( object sender, KeyEventArgs e) { //比如你的窗体名是frmMain,确定按钮btnOK,保存按钮btnSave //单键 switch (e.KeyCode) { case Keys.F1: btnOK_Click( this ,

vue 自定义全局按键修饰符

Deadly 提交于 2019-11-27 09:56:43
在监听键盘事件时,我们经常需要检查常见的键值。Vue 允许为 v-on 在监听键盘事件时添加按键修饰符: JS部分: 1 Vue.config.keyCodes = { 2 f2:113, 3 } 4 var app = new Vue({ 5 el: "#app", 6 data() { 7 return { 8 msg: "我是谁,我从哪里来,我又要往哪里去" 9 } 10 }, 11 methods:{ 12 submit(){ 13 console.log("你按了回车键"); 14 }, 15 f2submit(){ 16 console.log("你按了f2键"); 17 } 18 } 19 }); HTML部分: 1 <div id="app"> 2 <p><input type="text" placeholder="回车可提交" @keyup.enter="submit"></p> 3 <p><input type="text" placeholder="f2可提交" @keyup.f2="f2submit"></p> 4 </div> 结果: Vue内置的按键名: .enter .tab .delete (捕获“删除”和“退格”键) .esc .space .up .down .left .right keyCode列表: 1 keycode 0 = 2

“A namespace cannot directly contain members such as fields or methods” in Net.Reflector [closed]

天大地大妈咪最大 提交于 2019-11-27 09:00:01
I am trying to use this code for NET.reflector. Using Reflexil, I am trying to replace code with this, if(Input.GetKeyDown(KeyCode.Keypad5)) { int i = 0; Character localPlayer = PlayerClient.GetLocalPlayer().controllable.GetComponent<Character>(); foreach (UnityEngine.Object obj2 in UnityEngine.Object.FindObjectsOfType(typeof(LootableObject))) { if (obj2 != null) { i++; LootableObject loot = (LootableObject) obj2; Debug.Log("Loot "+i+": "+loot.transform.position.ToString()); CCMotor ccmotor = localPlayer.ccmotor; if(ccmotor != null && tpPos1 != Vector3.zero) { ccmotor.Teleport(loot.transform

Jquery: detect if middle or right mouse button is clicked, if so, do this:

☆樱花仙子☆ 提交于 2019-11-27 08:55:37
Check out my jsfiddle demo , if e.which == 1 then when you left click the h2 it will e.which == 2 or e.which == 3 then it wont work. 2 is the middle mouse button, and 3 is the right mouse button. i found this too: JQuery provides an e.which attribute, returning 1, 2, 3 for left, middle, and right click respectively. So you could also use if (e.which == 3) { alert("right click"); } This code isn't working: code: $("h2").live('click', function(e) { if( e.which == 2 ) { e.preventDefault(); alert("middle button"); } }); burntblark You may want to trap the mousedown event, and you also need to