473,473 Members | 1,456 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Any work-around? Opera 9 and keyCode

Hi,

I have function that works via onkeypressed -

for example, what to catch when a user presses a punctuation symbol
such as '.'

So I check keyCode for that - works just fine in
Opera 8, Mozilla/Firefox, IE

But in Opera 9 my code catches _both_ '.' and Delete button pressed -
both return 46 as a keyCode.
keyCode = evt.keyCode ? evt.keyCode :
evt.charCode ? evt.charCode :
evt.which ? evt.which : void 0;
CurrentKey = String.fromCharCode(keyCode) -

value is "." in _both_ cases.

In Opera 8, Mozilla/Firefox, IE the function working via
onkeypressed is NOT even called when I press Delete button...
I don't believe I am the first person to ran into this issue so
I hope some one has already figure out what to do -
don't let Opera 9 'think' that '.' was pressed when Delete button
was pressed.
--
Regards,
Paul Gorodyansky
http://RusWin.net
Sep 14 '06 #1
3 5133
function that works via OnKeyDown showed more details -
unlike onkeypressed it _is_ called when Delete button is pressed.

So Opera 9 has a bug?

According to the value table for example here: http://tinyurl.com/pnjx4

keyCode value for Delete key is 46 while for a dot - '.' - value is 190

Firefox and IE show exactly that in the function called via onkeydown -
190 and 46

while Opera 9 shows 46 for _both_ Delete key abd '.'!

That is, it gives wrong value for '.'

Bug? Is it possible to find a work-around?

--
Regards,
Paul Gorodyansky
http://RusWin.net
Sep 14 '06 #2
Hi,

Found more details - looks like Opera 9 uses ASCII code and KeyCode
for Del and '.' in an opposite way to other browsers:

So does Opera 9 have a bug?

My function that works via OnKeyDown showed more details -

According to the value table for example here: http://tinyurl.com/pnjx4

- keyCode value for Delete key is 46
- while for a dot - '.' - value is 190

Firefox and IE show exactly that in the function called via onkeydown -
46 and 190

while Opera 9 shows 46 for _both_ Delete key abd '.'

That is, it gives wrong value for '.' - gives ASCII code instead
of keyCode (should be 190)
In the function that works via onkeypressed it's also wrong:

Here Opera 9 gives keyCode instead of ASCII code for Delete button:

for example, '[' - correct ASCII code 91
'.' - correct ASCII code 46

Del - incorrect - should be ASCII code 127 but instead it gives keyCode
= 46
Bug? Is it possible to find a work-around?
--
Regards,
Paul
Sep 14 '06 #3

So how to distinguish whether '.' was pressed or Delete in Opera 9?

Found more details - looks like Opera 9 uses ASCII code and KeyCode
for Del and '.' in an opposite way to other browsers:

So does Opera 9 have a bug?

My function that works via OnKeyDown showed more details -

According to the value table for example here: http://tinyurl.com/pnjx4

- keyCode value for Delete key is 46
- while for a dot - '.' - value is 190

Firefox and IE show exactly that in the function called via onkeydown -
46 and 190

while Opera 9 shows 46 for _both_ Delete key abd '.'

That is, it gives wrong value for '.' - gives ASCII code instead
of keyCode (should be 190)
In the function that works via onkeypressed it's also wrong:

Here Opera 9 gives keyCode instead of ASCII code for Delete button:

for example, '[' - correct ASCII code 91
'.' - correct ASCII code 46

Del - incorrect - should be ASCII code 127 but instead it gives keyCode
= 46
Bug? Is it possible to find a work-around?

--
Regards,
Paul
Sep 14 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Jonas | last post by:
This works fine in Win XP but does not work at all in Win 98. Private WithEvents objIExplorer As InternetExplorer I have to do it like this to get it to work in Win 98 Dim objIExplorer As...
3
by: Douglas Buchanan | last post by:
Buttons don't work if form is opened on startup A2k If 'frmMain' is set to open by default at startup none of the buttons work. If 'frmMain' is opened from the database window then all the...
4
by: Paul T. RONG | last post by:
Dear All, I add two new tables to the database and then the disable shift key codes don't work. These two new tables are actually created by two queries, and only these two are in the front end,...
6
by: benb | last post by:
I have form that looks a lot like a search bar for the user to search for records matching specified criteria (e.g. first names containing "ben"). For robust results, an intermediary form displays...
2
by: Holysmoke | last post by:
Hi, I have a asp.net form with a button in it. In the onlclick event of button I want to write a function which does some a bit of work with a timespan of 15 seconds. So I want to show a image...
3
by: musosdev | last post by:
Hi guys Okay, I've setup my projects to open and compile fine in VS2005 using FPSE and remote web, but it's *really* slow. So I thought I'd have a go at doing it the normal way, by loading from...
48
by: Jimmy | last post by:
thanks to everyone that helped, unfortunately the code samples people gave me don't work. here is what i have so far: <% Dim oConn, oRS, randNum Randomize() randNum = (CInt(1000 * Rnd) + 1) *...
33
by: bonk | last post by:
I have an application that needs to perform some background work, i.e. Logging, wich must not block the main thread. How would I basically design such a scenario? It is obvious that I should do...
3
by: hscott93 | last post by:
Hello. I have a new Vista based laptop at work that connects to a Windows 2003 Small Business Server at work via an assigned, static IP address. When I take the laptop home, I have router that...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
1
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.