469,360 Members | 2,185 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,360 developers. It's quick & easy.

Firefox Key Press Problem

Hi

I have the following code in my site, however it is currently not working in firefox could someone please tell me why, thanks in advance

Expand|Select|Wrap|Line Numbers
  1. function buttonpress(button) {
  2. var key = new Array(); 
  3. key['-'] = "javascript:AddItem()";
  4. isNetscape=(document.layers);
  5. eventChooser = (isNetscape) ? button.which : event.keyCode;
  6. which = String.fromCharCode(eventChooser).toLowerCase();
  7. for (var i in key) if (which == i) window.location = key[i];
  8. }
  9. document.onkeypress = buttonpress;
  10.  
Mar 21 '08 #1
2 1324
mrhoo
428 256MB
Hard to say what you are trying to do,
but this will log the lower cased keystrokes to an array

Expand|Select|Wrap|Line Numbers
  1. function getKeypress(e){
  2.     e= window.event || e;
  3.     var k= e.charCode || e.keyCode;
  4.     var which= String.fromCharCode(k).toLowerCase();
  5.     keyLog.push(which);
  6. }
  7. window.keyLog=[];
  8.  
  9. document.onkeypress= getKeypress;
  10. //test
  11. document.ondblclick=function(){alert(keyLog)};
Mar 22 '08 #2
this peice of code is the key that is used to add a note on the site when pressed

Expand|Select|Wrap|Line Numbers
  1. key['-'] = "javascript:AddItem()";
Mar 30 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Jim | last post: by
reply views Thread by Joel Barsotti | last post: by
10 posts views Thread by Paul Gorodyansky | last post: by
5 posts views Thread by david | last post: by
1 post views Thread by CARIGAR | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.