467,210 Members | 1,400 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

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

trouble with onkeydown

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

<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;
// ...
return (true);
// End -->
<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
  • viewed: 1210
1 Reply
In article <OM********************@twister.nyroc.rr.com>, "George Hester"
<he********@hotmail.com> writes:

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

<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;


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

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

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Z | last post: by
10 posts views Thread by b.dam@gmx.net | last post: by
reply views Thread by =?Utf-8?B?Q0dX?= | last post: by
reply views Thread by CGW | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.