473,397 Members | 1,985 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

trouble with onkeydown

This element is the only disabled=false element on the form:

<HEAD>
....
<SCRIPT type="text/javascript">
<!-- Begin
function ValidateKey(e);
e = event || window.event;
var key;
var skey;
if (document.layers){
key = e.which;
skey = e.which;
} else {
key = e.keyCode;
skey = e.keyCode;
}
alert(key);
// ...
return (true);
}
// End -->
</SCRIPT>
....
</HEAD>
<BODY onload="javascript:document.forms['frm1'].elements['1'].focus(); ...."
....
<FORM id="frm1" ...>
<INPUT id="1" type="text" onkeydown="javascript:ValidateKey();" ..../>
....

When the document loads a message comes up which says 0. This seems wrong to me since no key was pressed. I understand why though. But what makes it worse is that if the message box is OK'd and the user types ANY character key such as m; p; t;... but not either of the ctrl keys or alt (those kind) on the keyboard, a message box comes up that says 0.

And then the issue is compounded because if the user OK's that message box and types another character, those that I described above then no message box; which is what I expect in the whole procedure here. The first one I can deal with but my "what makes it worse" is really uncalled for and I cannot figure out how to get the first key entered to not return 0. Thanks.

--
George Hester
__________________________________
Jul 20 '05 #1
1 1326
In article <OM********************@twister.nyroc.rr.com>, "George Hester"
<he********@hotmail.com> writes:

This element is the only disabled=3Dfalse element on the form:

<HEAD>
...
<SCRIPT type=3D"text/javascript">
<!-- Begin
function ValidateKey(e);
e =3D event || window.event;
var key;
var skey;
if (document.layers){
key =3D e.which;
skey =3D e.which;


<--snip-->

Here I go with the 3D's again.

Suggestion: In the future, it might be best if you give a URL to a test page
and in the test page, include the problem. If you don't see the 3D's above then
I guess my point is moot, but know I see them here as well, as in most of your
posts.

Not asking you to change your OE settings, but try to be friendly to those of
us who don't use OE?
--
Randy
Jul 20 '05 #2

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

Similar topics

6
by: Z | last post by:
I have sub-classed the TextBox. In its OnKeyDown event I can intercept key strokes, examine them, etc. When I get a certain keycode (e.g., 'A') I want to change it to another unicode key from a...
3
by: euler | last post by:
why did the keydown event not fire in this simple example? <HTML> <HEAD><title>keydown_div</title> <script type="text/javascript"> function keydown() { alert("keydown"); } </script>
10
by: b.dam | last post by:
I'm trying the following: function grid() { this._el = document.createElement("TABLE"); var self = this; document.addEventListener("onkeydown", function(event) {self.gridKeyDown(event);},...
2
by: Iver Erling Årva | last post by:
I have come across a problem with the onKeyDown event in some of my forms. I'm using onKeyDown in <form> as a standard method to open my help screen system throughout my system, but I have...
0
by: =?Utf-8?B?Q0dX?= | last post by:
I have a .NET 1.1 application which uses several grids of text boxs (in repeaters and datagrids) for entering arrays of time values. I use onkeydown to allow users to navigate through the grids...
0
by: CGW | last post by:
I posted this in a .NET general newsgroup, but then found this group and I think it would be more appropriately posted here. Even though the problem is partially with client side behavior, I'm...
1
eboyjr14
by: eboyjr14 | last post by:
I have this UserScript for Grease monkey. but I can't get the onleydown event to fire in FIREFOX only. I've looked everywhere! // ==UserScript== // @name iGoogle Suggest //...
8
by: Tony Johansson | last post by:
Hello! I wonder can somebody explain when is it suitable to use these methods OnKeyUp, OnKeyDown and OnKeyPress because these raise an event. These are located in class UserControl. If these...
5
matheussousuke
by: matheussousuke | last post by:
Hello, I'm using tiny MCE plugin on my oscommerce and it is inserting my website URL when I use insert image function in the emails. The goal is: Make it send the email with the URL...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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...
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,...
0
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...

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.