473,804 Members | 3,447 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Firefox Key Press Problem

57 New Member
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 1441
mrhoo
428 Contributor
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
wangers16
57 New Member
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

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

Similar topics

7
1446
by: VK | last post by:
<http://www.mozilla.org/>
3
1326
by: Jim | last post by:
I had Firefox set as my default browser, but I wanted to change back to IE when testing my webservices. Easy enough....(in IE) Tools>Internet Options>Programs then check "Internet Explorer should check to see whether it is the default browser". I restarted IE and responded "Yes" to whether to make IE the default browser. I then started Firefox and selected "No" when it asked if it should be the default browser.
0
910
by: Joel Barsotti | last post by:
Hi, So with my search control I want people to be able to enter some text and press enter and have the search submit. I was doing this with javascript using the onKeyPress event for the individual textboxes I wanted to monitor then used the argument to pass the buttonn id I want to click and used more javascript to simulate the click. This worked great as anytext box I wanted could fire the submit button I wanted associated with it....
10
3057
by: Paul Gorodyansky | last post by:
Hi, Ran into the problem today - in INPUT field Firefox executes clean-yp of the content if a user presses Esc, _before_ control goes to the code via onkeydown - and search showed that it's a known issue: https://bugzilla.mozilla.org/show_bug.cgi?id=236628 The bug is closed due to the inactivity (I've just written to the Submiter because apparently I don't have rights to re-Open)
3
4178
by: aryayudhi | last post by:
I have a html page that has javascript that works perfectly in IE, but not in Firefox. The use of this javascript to change "Tab" to "Enter" Button. When we press Tab, it is like when we press Enter button. How to make this script can be run on Firefox? I would be grateful to anybody who can help me on this, as I have got out of my depth with this problem. Thanks, Arya ======== This is the script : <script language="javascript"...
2
9020
by: veronicab | last post by:
Hi, I have a small JavaScript code in a page to trap when user presses Return key. My problem is that if you visit the page and then enter a different url in address field, and press Return, that key press is also being captured. How can I distinguish when user is pressing Return on the address field in address bar? Works ok on IE, the problem appears only in Firefox. This is the code I have:
2
1241
by: ra88it | last post by:
I'm working on some javascript games, and I encountered what appears to be a bug specific to Firefox on Linux (I'm using several recent versions of Ubuntu). I'd love to get some help verifying that it is a bug as well as possibly devising a workaround. Here's the situation: in my game, you control a space ship with the arrow keys. You move the ship by pressing the arrow keys, and often you will press both the up key and the left or right...
5
1408
by: david | last post by:
I have a picture and it has onclick event, with invokes JavaScript function called ModuleManager(); Then it saves a copy of Node (Blocks, which is DIV) it tmp_blocks with all children elements. And it changes Blocks innerHTML with new one, which has form and after I press button which has onclick too and calls another function which Blocks innerHTML sets to tmp_blocks; But after that(when I want to press image again) FireFox says:...
5
22027
by: hannie | last post by:
onKeyPress does not work in Firefox. If use tab to navigate each field and press "Enter" on "Next" button to submit form and process to the next form / page, IE works well even if without onKeyPress code. However, Firefox supresses onKeyPress on submit when "Enter" key is pressed. e.which and code="13" does not work for submit button at all in Firefox nor by changing code to focus(). e.g. use tab to navigate each field, when tab goes...
0
9711
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10594
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10343
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10331
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10087
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6861
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5667
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3831
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.