A
Andrew DeFaria
I thought this would be fairly straight forward but apparently it's not.
Given the following html file:
<!DOCTYPE html PUBLIC "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<title>Test</title>
</head>
<body>
<form method="post" action="javascript:">
Type a key
<input
align = "right"
type = "text"
name = "field"
size = "8"
onkeydown = "alert ('keydown');"
onkeyup = "alert ('keyup');"
onchange = "alert ('change');"</form>
</body>
</html>
Pretty simple. (Browse to http://defaria.com/test.html). What one would
expect is if a key was typed that the following alerts would occur:
keydown, keyup and when you leave the field you'd get a change. Not so
with the two major browsers (well I'm using FireFox and IE).
With Firefox I get the following (click on the text input box and type a
character):
* keyup! Why not keydown first!
* change! Why a change?!? I should only get a change when I leave
the field no?
* keydown! It's about time!
Now click anywhere outside the text field to "leave" the field and...
Nothing.
Now with IE (again click on text input bos and type a character):
* keydown - cool, what I expect
* Nothing! - Hmmm what happened to the keyup?!?
Now click anywhere outside the test field to "leave" the field and:
* change: OK that's expected but again what happened to the keydown?
Anybody have any ideas? Opinions?
Given the following html file:
<!DOCTYPE html PUBLIC "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<title>Test</title>
</head>
<body>
<form method="post" action="javascript:">
Type a key
<input
align = "right"
type = "text"
name = "field"
size = "8"
onkeydown = "alert ('keydown');"
onkeyup = "alert ('keyup');"
onchange = "alert ('change');"</form>
</body>
</html>
Pretty simple. (Browse to http://defaria.com/test.html). What one would
expect is if a key was typed that the following alerts would occur:
keydown, keyup and when you leave the field you'd get a change. Not so
with the two major browsers (well I'm using FireFox and IE).
With Firefox I get the following (click on the text input box and type a
character):
* keyup! Why not keydown first!
* change! Why a change?!? I should only get a change when I leave
the field no?
* keydown! It's about time!
Now click anywhere outside the text field to "leave" the field and...
Nothing.
Now with IE (again click on text input bos and type a character):
* keydown - cool, what I expect
* Nothing! - Hmmm what happened to the keyup?!?
Now click anywhere outside the test field to "leave" the field and:
* change: OK that's expected but again what happened to the keydown?
Anybody have any ideas? Opinions?