keycode

keycode is always zero in Chrome for Android

笑着哭i 提交于 2019-11-27 02:09:41
问题 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

Javascript: different keyCodes on different browsers?

点点圈 提交于 2019-11-27 01:36:51
问题 So I've seen some forums posts about different browsers reporting differenct keyCodes, but everyone seems so avoid the "why?". I was trying to capture the colon (:) keyCode and realized that Firefox reports back e.keyCode 56. While Chrome reports back 186 (I think that's what it was). Is there a univeral way of getting the right keyCode across all browsers? And why are they different if they are the same keys? I would be more curious as to whether there is a international way of getting the

How to detect that Ctrl+R was pressed?

假装没事ソ 提交于 2019-11-27 01:22:40
问题 I'm coding a function in jquery that executes if Ctrl + R is pressed but I can't seem to find out what the left and right ctrl keycodes are... Can someone please help? UPDATE ///this works $(document).keydown(function(e){ if(e.keyCode==17){alert("control was pressed")}; }); Next Question-- How do I link control key press and another key press to execute a function? if(e.keyCode==17){llCtrlPress=1}; if(e.keyCode==97 && llCtrlPress=1){DO SOMETHING} ???????????? That seems like it would work

jquery keypress event object keyCode for firefox problem?

半城伤御伤魂 提交于 2019-11-26 22:27:16
问题 jQuery keypress event for FireFox gives encrypted keyCode property for event object after String.fromCharCode(e.keyCode) conversion but works perfect in Chrome. Following is the javascript code: <!-- #booter and #text are ids of html element textarea --> <script type="text/javascript"> $(function(){ $('#booter').keypress(function(e){ var input = $(this).val() + String.fromCharCode(e.keyCode); $('#text').focus().val(input); return false; }); }); </script> 回答1: You should use e.charCode in

What are the JavaScript KeyCodes? [closed]

雨燕双飞 提交于 2019-11-26 19:28:25
What keycodes are available for JavaScript? If they're not the same for all browsers, please list the keycodes for each browser. user736373 keyCodes are different from the ASCII values. For a complete keyCode reference, see http://unixpapa.com/js/key.html For example, Numpad numbers have keyCodes 96 - 105, which corresponds to the beginning of lowercase alphabet in ASCII. This could lead to problems in validating numeric input. Web_Designer Followed @pimvdb's advice , and created my own: http://daniel-hug.github.io/characters/ Be patient, as it takes a few seconds to generate an element for

How to convert ASCII character to CGKeyCode?

女生的网名这么多〃 提交于 2019-11-26 16:06:19
I need a function that, given a character, returns the CGKeyCode associated with the position of that character on the current keyboard layout. E.g., given "b", it should return kVK_ANSI_B if using U.S. QWERTY, or kVK_ANSI_N if using Dvorak. The Win32 API has the function VkKeyScan() for this purpose; X11 has the function XStringToKeySym() . Is there such a function in the CG API? I need this in order to pass a parameter to CGEventCreateKeyboardEvent() . I've tried using CGEventKeyboardSetUnicodeString() instead, but that apparently does not support modifier flags (which I need). I have

Where can I find a list of Mac virtual key codes?

妖精的绣舞 提交于 2019-11-26 14:54:43
I'm using CGEventCreateKeyboardEvent and need to know what CGKeyCode values to use. Specifically, I am after the key code for the Command key. The docs give examples for other keys: z is 6 , shift is 56 . There must be a list of Mac virtual keycodes somewhere? Matt B. The more canonical reference is in <HIToolbox/Events.h> : /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Headers/Events.h In newer Versions of MacOS the "Events.h" moved to here: /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Carbon.framework

C# How to translate virtual keycode to char?

谁说我不能喝 提交于 2019-11-26 14:41:21
I am trying to map a virtual keycode to a char. My code uses ProcessCmdKey to listen to WM_KEYDOWN which gives me access to the key pressed. For example, when I press single quote I get a key of 222 which I want to have it mapped to keychar 39 which represents... you guessed it... single quote. My dev context is: - .net Framework 2.0 - UserControl placed in a lot of places Do you know the answer to the question? Isn't that what the System.Windows.Form.KeysConverter class is for? KeysConverter kc = new KeysConverter(); string keyChar = kc.ConvertToString(keyData); Horas Yes, I did use the

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

蹲街弑〆低调 提交于 2019-11-26 14:22:30
问题 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(

How to know if .keyup() is a character key (jQuery)

青春壹個敷衍的年華 提交于 2019-11-26 12:37:11
问题 How to know if .keyup() is a character key (jQuery) $(\"input\").keyup(function() { if (key is a character) { //such as a b A b c 5 3 2 $ # ^ ! ^ * # ...etc not enter key or shift or Esc or space ...etc /* Do stuff */ } }); 回答1: Note: In hindsight this was a quick and dirty answer, and may not work in all situations. To have a reliable solution, see Tim Down's answer (copy pasting that here as this answer is still getting views and upvotes): You can't do this reliably with the keyup event. If