昨日、jQuery.keyboardの開発中に、ブラウザーの絶対的な非互換性、ひどく不快な不一致などに遭遇しました。 さまざまなブラウザでevent.keyCodeを返します。 驚いたことに、私を喜ばせたのはIE 6(ies4linux)だけで、最も動揺したのはOpera 10でした。ChromiumとFoxは同じ結果を返しました。
最初に、テストコード:
<! DOCTYPE html >
< html >
< head >
< meta http - equiv = 'content-type' content = 'text/html; charset=utf-8' />
< title > Javascript Event Test </ title >
</ head >
< body ></ body >
< script type = 'text/javascript' > var keys = {};
var body = document . getElementsByTagName ( "body" )[0];
var dumpObj = function ( obj ) {
var dump = "" ;
for (var i in obj ) {
dump += i + ":" + obj [ i ] + "; " ;
}
return dump ;
}
document . onkeydown = function ( e ) {
e = e || event ;
keys [ e . keyCode ] = 1 ;
body . innerHTML += dumpObj ( keys ) + "<br />" ;
}
document . onkeyup = function ( e ) {
e = e || event ;
keys [ e . keyCode ] = 0 ;
} < /script >
< /html >
— ( ):
shift — 16 ctrl — 17 alt — 18 IE , ( ) shift + ctrl — 16+17 shift + alt — 16+18 ctrl + alt — 17+18 Firefox 3.5 shift + ctrl — 16+0 ctrl + shift — 17+0 shift + alt — 16+224 alt + shift — 18+16 ctrl + alt — 17+18 alt + ctrl — 18+17 Chromium 4 shift + ctrl — 16+0 ctrl + shift — 17+0 shift + alt — 16+91 alt + shift — 18+16 ctrl + alt — 17+18 alt + ctrl — 18+17 Opera 10 shift + ctrl — 16 ( Ctrl ) ctrl + shift — 17 ( Shift ) shift + alt — 16+0 alt + shift — 18 ( Shift ) ctrl + alt — 17+18 alt + ctrl — 18 ( Ctrl )
, Meta .
— :
1. «» ? . , — shift+alt
2. ? , , event.shiftKey , . , 224 , 18
3. — , « Handling Keyboard Shortcuts ». , Ctrl/Alt/Shift + . - Space+X C+V+B , .
4. . , , 7 8, .
5. - - ?
. anatoly-rr . , keydown, — keyup , . — , onblur , ?
( )
?
, Windows ? , ? , , , -. , , — .
<! DOCTYPE html >
< html >
< head >
< meta http - equiv = 'content-type' content = 'text/html; charset=utf-8' />
< title > Javascript Event Test </ title >
</ head >
< body ></ body >
< script type = 'text/javascript' > var keys = {};
var body = document . getElementsByTagName ( "body" )[0];
var dumpObj = function ( obj ) {
var dump = "" ;
for (var i in obj ) {
dump += i + ":" + obj [ i ] + "; " ;
}
return dump ;
}
document . onkeydown = function ( e ) {
e = e || event ;
keys [ e . keyCode ] = 1 ;
body . innerHTML += dumpObj ( keys ) + "<br />" ;
}
document . onkeyup = function ( e ) {
e = e || event ;
keys [ e . keyCode ] = 0 ;
}< /script >
< /html >
— ( ):
shift — 16 ctrl — 17 alt — 18 IE , ( ) shift + ctrl — 16+17 shift + alt — 16+18 ctrl + alt — 17+18 Firefox 3.5 shift + ctrl — 16+0 ctrl + shift — 17+0 shift + alt — 16+224 alt + shift — 18+16 ctrl + alt — 17+18 alt + ctrl — 18+17 Chromium 4 shift + ctrl — 16+0 ctrl + shift — 17+0 shift + alt — 16+91 alt + shift — 18+16 ctrl + alt — 17+18 alt + ctrl — 18+17 Opera 10 shift + ctrl — 16 ( Ctrl ) ctrl + shift — 17 ( Shift ) shift + alt — 16+0 alt + shift — 18 ( Shift ) ctrl + alt — 17+18 alt + ctrl — 18 ( Ctrl )
, Meta .
— :
1. «» ? . , — shift+alt
2.? , , event.shiftKey , . , 224 , 18
3. — , « Handling Keyboard Shortcuts ». , Ctrl/Alt/Shift + . - Space+X C+V+B , .
4. . , , 7 8, .
5. - - ?
. anatoly-rr . , keydown, — keyup , . — , onblur , ?
( )
?
, Windows ? , ? , , , -. , , — .
<! DOCTYPE html >
< html >
< head >
< meta http - equiv = 'content-type' content = 'text/html; charset=utf-8' />
< title > Javascript Event Test </ title >
</ head >
< body ></ body >
< script type = 'text/javascript' > var keys = {};
var body = document . getElementsByTagName ( "body" )[0];
var dumpObj = function ( obj ) {
var dump = "" ;
for (var i in obj ) {
dump += i + ":" + obj [ i ] + "; " ;
}
return dump ;
}
document . onkeydown = function ( e ) {
e = e || event ;
keys [ e . keyCode ] = 1 ;
body . innerHTML += dumpObj ( keys ) + "<br />" ;
}
document . onkeyup = function ( e ) {
e = e || event ;
keys [ e . keyCode ] = 0 ;
}
< /script >
< /html >
— ( ):
shift — 16 ctrl — 17 alt — 18 IE , ( ) shift + ctrl — 16+17 shift + alt — 16+18 ctrl + alt — 17+18 Firefox 3.5 shift + ctrl — 16+0 ctrl + shift — 17+0 shift + alt — 16+224 alt + shift — 18+16 ctrl + alt — 17+18 alt + ctrl — 18+17 Chromium 4 shift + ctrl — 16+0 ctrl + shift — 17+0 shift + alt — 16+91 alt + shift — 18+16 ctrl + alt — 17+18 alt + ctrl — 18+17 Opera 10 shift + ctrl — 16 ( Ctrl ) ctrl + shift — 17 ( Shift ) shift + alt — 16+0 alt + shift — 18 ( Shift ) ctrl + alt — 17+18 alt + ctrl — 18 ( Ctrl )
, Meta .
— :
1. «» ? . , — shift+alt
2. ? , , event.shiftKey , . , 224 , 18
3. — , « Handling Keyboard Shortcuts ». , Ctrl/Alt/Shift + . - Space+X C+V+B , .
4. . , , 7 8, .
5. - - ?
. anatoly-rr . , keydown, — keyup , . — , onblur , ?
( )
?
, Windows ? , ? , , , -. , , — .
<! DOCTYPE html >
< html >
< head >
< meta http - equiv = 'content-type' content = 'text/html; charset=utf-8' />
< title > Javascript Event Test </ title >
</ head >
< body ></ body >
< script type = 'text/javascript' > var keys = {};
var body = document . getElementsByTagName ( "body" )[0];
var dumpObj = function ( obj ) {
var dump = "" ;
for (var i in obj ) {
dump += i + ":" + obj [ i ] + "; " ;
}
return dump ;
}
document . onkeydown = function ( e ) {
e = e || event ;
keys [ e . keyCode ] = 1 ;
body . innerHTML += dumpObj ( keys ) + "<br />" ;
}
document . onkeyup = function ( e ) {
e = e || event ;
keys [ e . keyCode ] = 0 ;
}
< /script >
< /html >
— ( ):
shift — 16 ctrl — 17 alt — 18 IE , ( ) shift + ctrl — 16+17 shift + alt — 16+18 ctrl + alt — 17+18 Firefox 3.5 shift + ctrl — 16+0 ctrl + shift — 17+0 shift + alt — 16+224 alt + shift — 18+16 ctrl + alt — 17+18 alt + ctrl — 18+17 Chromium 4 shift + ctrl — 16+0 ctrl + shift — 17+0 shift + alt — 16+91 alt + shift — 18+16 ctrl + alt — 17+18 alt + ctrl — 18+17 Opera 10 shift + ctrl — 16 ( Ctrl ) ctrl + shift — 17 ( Shift ) shift + alt — 16+0 alt + shift — 18 ( Shift ) ctrl + alt — 17+18 alt + ctrl — 18 ( Ctrl )
, Meta .
— :
1. «» ? . , — shift+alt
2. ? , , event.shiftKey , . , 224 , 18
3. — , « Handling Keyboard Shortcuts ». , Ctrl/Alt/Shift + . - Space+X C+V+B , .
4. . , , 7 8, .
5. - - ?
. anatoly-rr . , keydown, — keyup , . — , onblur , ?
( )
?
, Windows ? , ? , , , -. , , — .
<! DOCTYPE html >
< html >
< head >
< meta http - equiv = 'content-type' content = 'text/html; charset=utf-8' />
< title > Javascript Event Test </ title >
</ head >
< body ></ body >
< script type = 'text/javascript' > var keys = {};
var body = document . getElementsByTagName ( "body" )[0];
var dumpObj = function ( obj ) {
var dump = "" ;
for (var i in obj ) {
dump += i + ":" + obj [ i ] + "; " ;
}
return dump ;
}
document . onkeydown = function ( e ) {
e = e || event ;
keys [ e . keyCode ] = 1 ;
body . innerHTML += dumpObj ( keys ) + "<br />" ;
}
document . onkeyup = function ( e ) {
e = e || event ;
keys [ e . keyCode ] = 0 ;
}
< /script >
< /html >
— ( ):
shift — 16 ctrl — 17 alt — 18 IE , ( ) shift + ctrl — 16+17 shift + alt — 16+18 ctrl + alt — 17+18 Firefox 3.5 shift + ctrl — 16+0 ctrl + shift — 17+0 shift + alt — 16+224 alt + shift — 18+16 ctrl + alt — 17+18 alt + ctrl — 18+17 Chromium 4 shift + ctrl — 16+0 ctrl + shift — 17+0 shift + alt — 16+91 alt + shift — 18+16 ctrl + alt — 17+18 alt + ctrl — 18+17 Opera 10 shift + ctrl — 16 ( Ctrl ) ctrl + shift — 17 ( Shift ) shift + alt — 16+0 alt + shift — 18 ( Shift ) ctrl + alt — 17+18 alt + ctrl — 18 ( Ctrl )
, Meta .
— :
1. «» ? . , — shift+alt
2. ? , , event.shiftKey , . , 224 , 18
3. — , « Handling Keyboard Shortcuts ». , Ctrl/Alt/Shift + . - Space+X C+V+B , .
4. . , , 7 8, .
5. - - ?
. anatoly-rr . , keydown, — keyup , . — , onblur , ?
( )
?
, Windows ? , ? , , , -. , , — .
<! DOCTYPE html >
< html >
< head >
< meta http - equiv = 'content-type' content = 'text/html; charset=utf-8' />
< title > Javascript Event Test </ title >
</ head >
< body ></ body >
< script type = 'text/javascript' > var keys = {};
var body = document . getElementsByTagName ( "body" )[0];
var dumpObj = function ( obj ) {
var dump = "" ;
for (var i in obj ) {
dump += i + ":" + obj [ i ] + "; " ;
}
return dump ;
}
document . onkeydown = function ( e ) {
e = e || event ;
keys [ e . keyCode ] = 1 ;
body . innerHTML += dumpObj ( keys ) + "<br />" ;
}
document . onkeyup = function ( e ) {
e = e || event ;
keys [ e . keyCode ] = 0 ;
}
< /script >
< /html >
— ( ):
shift — 16 ctrl — 17 alt — 18 IE , ( ) shift + ctrl — 16+17 shift + alt — 16+18 ctrl + alt — 17+18 Firefox 3.5 shift + ctrl — 16+0 ctrl + shift — 17+0 shift + alt — 16+224 alt + shift — 18+16 ctrl + alt — 17+18 alt + ctrl — 18+17 Chromium 4 shift + ctrl — 16+0 ctrl + shift — 17+0 shift + alt — 16+91 alt + shift — 18+16 ctrl + alt — 17+18 alt + ctrl — 18+17 Opera 10 shift + ctrl — 16 ( Ctrl ) ctrl + shift — 17 ( Shift ) shift + alt — 16+0 alt + shift — 18 ( Shift ) ctrl + alt — 17+18 alt + ctrl — 18 ( Ctrl )
, Meta .
— :
1. «» ? . , — shift+alt
2. ? , , event.shiftKey , . , 224 , 18
3. — , « Handling Keyboard Shortcuts ». , Ctrl/Alt/Shift + . - Space+X C+V+B , .
4. . , , 7 8, .
5. - - ?
. anatoly-rr . , keydown, — keyup , . — , onblur , ?
( )
?
, Windows ? , ? , , , -. , , — .
<! DOCTYPE html >
< html >
< head >
< meta http - equiv = 'content-type' content = 'text/html; charset=utf-8' />
< title > Javascript Event Test </ title >
</ head >
< body ></ body >
< script type = 'text/javascript' > var keys = {};
var body = document . getElementsByTagName ( "body" )[0];
var dumpObj = function ( obj ) {
var dump = "" ;
for (var i in obj ) {
dump += i + ":" + obj [ i ] + "; " ;
}
return dump ;
}
document . onkeydown = function ( e ) {
e = e || event ;
keys [ e . keyCode ] = 1 ;
body . innerHTML += dumpObj ( keys ) + "<br />" ;
}
document . onkeyup = function ( e ) {
e = e || event ;
keys [ e . keyCode ] = 0 ;
}
< /script >
< /html >
— ( ):
shift — 16 ctrl — 17 alt — 18 IE , ( ) shift + ctrl — 16+17 shift + alt — 16+18 ctrl + alt — 17+18 Firefox 3.5 shift + ctrl — 16+0 ctrl + shift — 17+0 shift + alt — 16+224 alt + shift — 18+16 ctrl + alt — 17+18 alt + ctrl — 18+17 Chromium 4 shift + ctrl — 16+0 ctrl + shift — 17+0 shift + alt — 16+91 alt + shift — 18+16 ctrl + alt — 17+18 alt + ctrl — 18+17 Opera 10 shift + ctrl — 16 ( Ctrl ) ctrl + shift — 17 ( Shift ) shift + alt — 16+0 alt + shift — 18 ( Shift ) ctrl + alt — 17+18 alt + ctrl — 18 ( Ctrl )
, Meta .
— :
1. «» ? . , — shift+alt
2. ? , , event.shiftKey , . , 224 , 18
3. — , « Handling Keyboard Shortcuts ». , Ctrl/Alt/Shift + . - Space+X C+V+B , .
4. . , , 7 8, .
5. - - ?
. anatoly-rr . , keydown, — keyup , . — , onblur , ?
( )
?
, Windows ? , ? , , , -. , , — .
<! DOCTYPE html >
< html >
< head >
< meta http - equiv = 'content-type' content = 'text/html; charset=utf-8' />
< title > Javascript Event Test </ title >
</ head >
< body ></ body >
< script type = 'text/javascript' > var keys = {};
var body = document . getElementsByTagName ( "body" )[0];
var dumpObj = function ( obj ) {
var dump = "" ;
for (var i in obj ) {
dump += i + ":" + obj [ i ] + "; " ;
}
return dump ;
}
document . onkeydown = function ( e ) {
e = e || event ;
keys [ e . keyCode ] = 1 ;
body . innerHTML += dumpObj ( keys ) + "<br />" ;
}
document . onkeyup = function ( e ) {
e = e || event ;
keys [ e . keyCode ] = 0 ;
}
< /script >
< /html >
— ( ):
shift — 16 ctrl — 17 alt — 18 IE , ( ) shift + ctrl — 16+17 shift + alt — 16+18 ctrl + alt — 17+18 Firefox 3.5 shift + ctrl — 16+0 ctrl + shift — 17+0 shift + alt — 16+224 alt + shift — 18+16 ctrl + alt — 17+18 alt + ctrl — 18+17 Chromium 4 shift + ctrl — 16+0 ctrl + shift — 17+0 shift + alt — 16+91 alt + shift — 18+16 ctrl + alt — 17+18 alt + ctrl — 18+17 Opera 10 shift + ctrl — 16 ( Ctrl ) ctrl + shift — 17 ( Shift ) shift + alt — 16+0 alt + shift — 18 ( Shift ) ctrl + alt — 17+18 alt + ctrl — 18 ( Ctrl )
, Meta .
— :
1. «» ? . , — shift+alt
2. ? , , event.shiftKey , . , 224 , 18
3. — , « Handling Keyboard Shortcuts ». , Ctrl/Alt/Shift + . - Space+X C+V+B , .
4. . , , 7 8, .
5. - - ?
. anatoly-rr . , keydown, — keyup , . — , onblur , ?
( )
?
, Windows ? , ? , , , -. , , — .
<! DOCTYPE html >
< html >
< head >
< meta http - equiv = 'content-type' content = 'text/html; charset=utf-8' />
< title > Javascript Event Test </ title >
</ head >
< body ></ body >
< script type = 'text/javascript' > var keys = {};
var body = document . getElementsByTagName ( "body" )[0];
var dumpObj = function ( obj ) {
var dump = "" ;
for (var i in obj ) {
dump += i + ":" + obj [ i ] + "; " ;
}
return dump ;
}
document . onkeydown = function ( e ) {
e = e || event ;
keys [ e . keyCode ] = 1 ;
body . innerHTML += dumpObj ( keys ) + "<br />" ;
}
document . onkeyup = function ( e ) {
e = e || event ;
keys [ e . keyCode ] = 0 ;
}
< /script >
< /html >
— ( ):
shift — 16 ctrl — 17 alt — 18 IE , ( ) shift + ctrl — 16+17 shift + alt — 16+18 ctrl + alt — 17+18 Firefox 3.5 shift + ctrl — 16+0 ctrl + shift — 17+0 shift + alt — 16+224 alt + shift — 18+16 ctrl + alt — 17+18 alt + ctrl — 18+17 Chromium 4 shift + ctrl — 16+0 ctrl + shift — 17+0 shift + alt — 16+91 alt + shift — 18+16 ctrl + alt — 17+18 alt + ctrl — 18+17 Opera 10 shift + ctrl — 16 ( Ctrl ) ctrl + shift — 17 ( Shift ) shift + alt — 16+0 alt + shift — 18 ( Shift ) ctrl + alt — 17+18 alt + ctrl — 18 ( Ctrl )
, Meta .
— :
1. «» ? . , — shift+alt
2. ? , , event.shiftKey , . , 224 , 18
3. — , « Handling Keyboard Shortcuts ». , Ctrl/Alt/Shift + . - Space+X C+V+B , .
4. . , , 7 8, .
5. - - ?
. anatoly-rr . , keydown, — keyup , . — , onblur , ?
( )
?
, Windows ? , ? , , , -. , , — .
<! DOCTYPE html >
< html >
< head >
< meta http - equiv = 'content-type' content = 'text/html; charset=utf-8' />
< title > Javascript Event Test </ title >
</ head >
< body ></ body >
< script type = 'text/javascript' > var keys = {};
var body = document . getElementsByTagName ( "body" )[0];
var dumpObj = function ( obj ) {
var dump = "" ;
for (var i in obj ) {
dump += i + ":" + obj [ i ] + "; " ;
}
return dump ;
}
document . onkeydown = function ( e ) {
e = e || event ;
keys [ e . keyCode ] = 1 ;
body . innerHTML += dumpObj ( keys ) + "<br />" ;
}
document . onkeyup = function ( e ) {
e = e || event ;
keys [ e . keyCode ] = 0 ;
}
< /script >
< /html >
— ( ):
shift — 16 ctrl — 17 alt — 18 IE , ( ) shift + ctrl — 16+17 shift + alt — 16+18 ctrl + alt — 17+18 Firefox 3.5 shift + ctrl — 16+0 ctrl + shift — 17+0 shift + alt — 16+224 alt + shift — 18+16 ctrl + alt — 17+18 alt + ctrl — 18+17 Chromium 4 shift + ctrl — 16+0 ctrl + shift — 17+0 shift + alt — 16+91 alt + shift — 18+16 ctrl + alt — 17+18 alt + ctrl — 18+17 Opera 10 shift + ctrl — 16 ( Ctrl ) ctrl + shift — 17 ( Shift ) shift + alt — 16+0 alt + shift — 18 ( Shift ) ctrl + alt — 17+18 alt + ctrl — 18 ( Ctrl )
, Meta .
— :
1. «» ? . , — shift+alt
2. ? , , event.shiftKey , . , 224 , 18
3. — , « Handling Keyboard Shortcuts ». , Ctrl/Alt/Shift + . - Space+X C+V+B , .
4. . , , 7 8, .
5. - - ?
. anatoly-rr . , keydown, — keyup , . — , onblur , ?
( )
?
, Windows ? , ? , , , -. , , — .
<! DOCTYPE html >
< html >
< head >
< meta http - equiv = 'content-type' content = 'text/html; charset=utf-8' />
< title > Javascript Event Test </ title >
</ head >
< body ></ body >
< script type = 'text/javascript' > var keys = {};
var body = document . getElementsByTagName ( "body" )[0];
var dumpObj = function ( obj ) {
var dump = "" ;
for (var i in obj ) {
dump += i + ":" + obj [ i ] + "; " ;
}
return dump ;
}
document . onkeydown = function ( e ) {
e = e || event ;
keys [ e . keyCode ] = 1 ;
body . innerHTML += dumpObj ( keys ) + "<br />" ;
}
document . onkeyup = function ( e ) {
e = e || event ;
keys [ e . keyCode ] = 0 ;
}
< /script >
< /html >
— ( ):
shift — 16 ctrl — 17 alt — 18 IE , ( ) shift + ctrl — 16+17 shift + alt — 16+18 ctrl + alt — 17+18 Firefox 3.5 shift + ctrl — 16+0 ctrl + shift — 17+0 shift + alt — 16+224 alt + shift — 18+16 ctrl + alt — 17+18 alt + ctrl — 18+17 Chromium 4 shift + ctrl — 16+0 ctrl + shift — 17+0 shift + alt — 16+91 alt + shift — 18+16 ctrl + alt — 17+18 alt + ctrl — 18+17 Opera 10 shift + ctrl — 16 ( Ctrl ) ctrl + shift — 17 ( Shift ) shift + alt — 16+0 alt + shift — 18 ( Shift ) ctrl + alt — 17+18 alt + ctrl — 18 ( Ctrl )
, Meta .
— :
1. «» ? . , — shift+alt
2. ? , , event.shiftKey , . , 224 , 18
3. — , « Handling Keyboard Shortcuts ». , Ctrl/Alt/Shift + . - Space+X C+V+B , .
4. . , , 7 8, .
5. - - ?
. anatoly-rr . , keydown, — keyup , . — , onblur , ?
( )
?
, Windows ? , ? , , , -. , , — .
<! DOCTYPE html >
< html >
< head >
< meta http - equiv = 'content-type' content = 'text/html; charset=utf-8' />
< title > Javascript Event Test </ title >
</ head >
< body ></ body >
< script type = 'text/javascript' > var keys = {};
var body = document . getElementsByTagName ( "body" )[0];
var dumpObj = function ( obj ) {
var dump = "" ;
for (var i in obj ) {
dump += i + ":" + obj [ i ] + "; " ;
}
return dump ;
}
document . onkeydown = function ( e ) {
e = e || event ;
keys [ e . keyCode ] = 1 ;
body . innerHTML += dumpObj ( keys ) + "<br />" ;
}
document . onkeyup = function ( e ) {
e = e || event ;
keys [ e . keyCode ] = 0 ;
}
< /script >
< /html >
— ( ):
shift — 16 ctrl — 17 alt — 18 IE , ( ) shift + ctrl — 16+17 shift + alt — 16+18 ctrl + alt — 17+18 Firefox 3.5 shift + ctrl — 16+0 ctrl + shift — 17+0 shift + alt — 16+224 alt + shift — 18+16 ctrl + alt — 17+18 alt + ctrl — 18+17 Chromium 4 shift + ctrl — 16+0 ctrl + shift — 17+0 shift + alt — 16+91 alt + shift — 18+16 ctrl + alt — 17+18 alt + ctrl — 18+17 Opera 10 shift + ctrl — 16 ( Ctrl ) ctrl + shift — 17 ( Shift ) shift + alt — 16+0 alt + shift — 18 ( Shift ) ctrl + alt — 17+18 alt + ctrl — 18 ( Ctrl )
, Meta .
— :
1. «» ? . , — shift+alt
2. ? , , event.shiftKey , . , 224 , 18
3. — , « Handling Keyboard Shortcuts ». , Ctrl/Alt/Shift + . - Space+X C+V+B , .
4. . , , 7 8, .
5. - - ?
. anatoly-rr . , keydown, — keyup , . — , onblur , ?
( )
?
, Windows ? , ? , , , -. , , — .
<! DOCTYPE html >
< html >
< head >
< meta http - equiv = 'content-type' content = 'text/html; charset=utf-8' />
< title > Javascript Event Test </ title >
</ head >
< body ></ body >
< script type = 'text/javascript' > var keys = {};
var body = document . getElementsByTagName ( "body" )[0];
var dumpObj = function ( obj ) {
var dump = "" ;
for (var i in obj ) {
dump += i + ":" + obj [ i ] + "; " ;
}
return dump ;
}
document . onkeydown = function ( e ) {
e = e || event ;
keys [ e . keyCode ] = 1 ;
body . innerHTML += dumpObj ( keys ) + "<br />" ;
}
document . onkeyup = function ( e ) {
e = e || event ;
keys [ e . keyCode ] = 0 ;
}
< /script >
< /html >
— ( ):
shift — 16 ctrl — 17 alt — 18 IE , ( ) shift + ctrl — 16+17 shift + alt — 16+18 ctrl + alt — 17+18 Firefox 3.5 shift + ctrl — 16+0 ctrl + shift — 17+0 shift + alt — 16+224 alt + shift — 18+16 ctrl + alt — 17+18 alt + ctrl — 18+17 Chromium 4 shift + ctrl — 16+0 ctrl + shift — 17+0 shift + alt — 16+91 alt + shift — 18+16 ctrl + alt — 17+18 alt + ctrl — 18+17 Opera 10 shift + ctrl — 16 ( Ctrl ) ctrl + shift — 17 ( Shift ) shift + alt — 16+0 alt + shift — 18 ( Shift ) ctrl + alt — 17+18 alt + ctrl — 18 ( Ctrl )
, Meta .
— :
1. «» ? . , — shift+alt
2. ? , , event.shiftKey , . , 224 , 18
3. — , « Handling Keyboard Shortcuts ». , Ctrl/Alt/Shift + . - Space+X C+V+B , .
4. . , , 7 8, .
5. - - ?
. anatoly-rr . , keydown, — keyup , . — , onblur , ?
( )
?
, Windows ? , ? , , , -. , , — .
<! DOCTYPE html >
< html >
< head >
< meta http - equiv = 'content-type' content = 'text/html; charset=utf-8' />
< title > Javascript Event Test </ title >
</ head >
< body ></ body >
< script type = 'text/javascript' > var keys = {};
var body = document . getElementsByTagName ( "body" )[0];
var dumpObj = function ( obj ) {
var dump = "" ;
for (var i in obj ) {
dump += i + ":" + obj [ i ] + "; " ;
}
return dump ;
}
document . onkeydown = function ( e ) {
e = e || event ;
keys [ e . keyCode ] = 1 ;
body . innerHTML += dumpObj ( keys ) + "<br />" ;
}
document . onkeyup = function ( e ) {
e = e || event ;
keys [ e . keyCode ] = 0 ;
}
< /script >
< /html >
— ( ):
shift — 16 ctrl — 17 alt — 18 IE , ( ) shift + ctrl — 16+17 shift + alt — 16+18 ctrl + alt — 17+18 Firefox 3.5 shift + ctrl — 16+0 ctrl + shift — 17+0 shift + alt — 16+224 alt + shift — 18+16 ctrl + alt — 17+18 alt + ctrl — 18+17 Chromium 4 shift + ctrl — 16+0 ctrl + shift — 17+0 shift + alt — 16+91 alt + shift — 18+16 ctrl + alt — 17+18 alt + ctrl — 18+17 Opera 10 shift + ctrl — 16 ( Ctrl ) ctrl + shift — 17 ( Shift ) shift + alt — 16+0 alt + shift — 18 ( Shift ) ctrl + alt — 17+18 alt + ctrl — 18 ( Ctrl )
, Meta .
— :
1. «» ? . , — shift+alt
2. ? , , event.shiftKey , . , 224 , 18
3. — , « Handling Keyboard Shortcuts ». , Ctrl/Alt/Shift + . - Space+X C+V+B , .
4. . , , 7 8, .
5. - - ?
. anatoly-rr . , keydown, — keyup , . — , onblur , ?
( )
?
, Windows ? , ? , , , -. , , — .
<! DOCTYPE html >
< html >
< head >
< meta http - equiv = 'content-type' content = 'text/html; charset=utf-8' />
< title > Javascript Event Test </ title >
</ head >
< body ></ body >
< script type = 'text/javascript' > var keys = {};
var body = document . getElementsByTagName ( "body" )[0];
var dumpObj = function ( obj ) {
var dump = "" ;
for (var i in obj ) {
dump += i + ":" + obj [ i ] + "; " ;
}
return dump ;
}
document . onkeydown = function ( e ) {
e = e || event ;
keys [ e . keyCode ] = 1 ;
body . innerHTML += dumpObj ( keys ) + "<br />" ;
}
document . onkeyup = function ( e ) {
e = e || event ;
keys [ e . keyCode ] = 0 ;
}
< /script >
< /html >
— ( ):
shift — 16 ctrl — 17 alt — 18 IE , ( ) shift + ctrl — 16+17 shift + alt — 16+18 ctrl + alt — 17+18 Firefox 3.5 shift + ctrl — 16+0 ctrl + shift — 17+0 shift + alt — 16+224 alt + shift — 18+16 ctrl + alt — 17+18 alt + ctrl — 18+17 Chromium 4 shift + ctrl — 16+0 ctrl + shift — 17+0 shift + alt — 16+91 alt + shift — 18+16 ctrl + alt — 17+18 alt + ctrl — 18+17 Opera 10 shift + ctrl — 16 ( Ctrl ) ctrl + shift — 17 ( Shift ) shift + alt — 16+0 alt + shift — 18 ( Shift ) ctrl + alt — 17+18 alt + ctrl — 18 ( Ctrl )
, Meta .
— :
1. «» ? . , — shift+alt
2. ? , , event.shiftKey , . , 224 , 18
3. — , « Handling Keyboard Shortcuts ». , Ctrl/Alt/Shift + . - Space+X C+V+B , .
4. . , , 7 8, .
5. - - ?
. anatoly-rr . , keydown, — keyup , . — , onblur , ?
( )
?
, Windows ? , ? , , , -. , , — .
<! DOCTYPE html >
< html >
< head >
< meta http - equiv = 'content-type' content = 'text/html; charset=utf-8' />
< title > Javascript Event Test </ title >
</ head >
< body ></ body >
< script type = 'text/javascript' > var keys = {};
var body = document . getElementsByTagName ( "body" )[0];
var dumpObj = function ( obj ) {
var dump = "" ;
for (var i in obj ) {
dump += i + ":" + obj [ i ] + "; " ;
}
return dump ;
}
document . onkeydown = function ( e ) {
e = e || event ;
keys [ e . keyCode ] = 1 ;
body . innerHTML += dumpObj ( keys ) + "<br />" ;
}
document . onkeyup = function ( e ) {
e = e || event ;
keys [ e . keyCode ] = 0 ;
}
< /script >
< /html >
— ( ):
shift — 16 ctrl — 17 alt — 18 IE , ( ) shift + ctrl — 16+17 shift + alt — 16+18 ctrl + alt — 17+18 Firefox 3.5 shift + ctrl — 16+0 ctrl + shift — 17+0 shift + alt — 16+224 alt + shift — 18+16 ctrl + alt — 17+18 alt + ctrl — 18+17 Chromium 4 shift + ctrl — 16+0 ctrl + shift — 17+0 shift + alt — 16+91 alt + shift — 18+16 ctrl + alt — 17+18 alt + ctrl — 18+17 Opera 10 shift + ctrl — 16 ( Ctrl ) ctrl + shift — 17 ( Shift ) shift + alt — 16+0 alt + shift — 18 ( Shift ) ctrl + alt — 17+18 alt + ctrl — 18 ( Ctrl )
, Meta .
— :
1. «» ? . , — shift+alt
2. ? , , event.shiftKey , . , 224 , 18
3. — , « Handling Keyboard Shortcuts ». , Ctrl/Alt/Shift + . - Space+X C+V+B , .
4. . , , 7 8, .
5. - - ?
. anatoly-rr . , keydown, — keyup , . — , onblur , ?
( )
?
, Windows ? , ? , , , -. , , — .
<! DOCTYPE html >
< html >
< head >
< meta http - equiv = 'content-type' content = 'text/html; charset=utf-8' />
< title > Javascript Event Test </ title >
</ head >
< body ></ body >
< script type = 'text/javascript' > var keys = {};
var body = document . getElementsByTagName ( "body" )[0];
var dumpObj = function ( obj ) {
var dump = "" ;
for (var i in obj ) {
dump += i + ":" + obj [ i ] + "; " ;
}
return dump ;
}
document . onkeydown = function ( e ) {
e = e || event ;
keys [ e . keyCode ] = 1 ;
body . innerHTML += dumpObj ( keys ) + "<br />" ;
}
document . onkeyup = function ( e ) {
e = e || event ;
keys [ e . keyCode ] = 0 ;
}
< /script >
< /html >
— ( ):
shift — 16 ctrl — 17 alt — 18 IE , ( ) shift + ctrl — 16+17 shift + alt — 16+18 ctrl + alt — 17+18 Firefox 3.5 shift + ctrl — 16+0 ctrl + shift — 17+0 shift + alt — 16+224 alt + shift — 18+16 ctrl + alt — 17+18 alt + ctrl — 18+17 Chromium 4 shift + ctrl — 16+0 ctrl + shift — 17+0 shift + alt — 16+91 alt + shift — 18+16 ctrl + alt — 17+18 alt + ctrl — 18+17 Opera 10 shift + ctrl — 16 ( Ctrl ) ctrl + shift — 17 ( Shift ) shift + alt — 16+0 alt + shift — 18 ( Shift ) ctrl + alt — 17+18 alt + ctrl — 18 ( Ctrl )
, Meta .
— :
1. «» ? . , — shift+alt
2. ? , , event.shiftKey , . , 224 , 18
3. — , « Handling Keyboard Shortcuts ». , Ctrl/Alt/Shift + . - Space+X C+V+B , .
4. . , , 7 8, .
5. - - ?
. anatoly-rr . , keydown, — keyup , . — , onblur , ?
( )
?
, Windows ? , ? , , , -. , , — .
<! DOCTYPE html >
< html >
< head >
< meta http - equiv = 'content-type' content = 'text/html; charset=utf-8' />
< title > Javascript Event Test </ title >
</ head >
< body ></ body >
< script type = 'text/javascript' > var keys = {};
var body = document . getElementsByTagName ( "body" )[0];
var dumpObj = function ( obj ) {
var dump = "" ;
for (var i in obj ) {
dump += i + ":" + obj [ i ] + "; " ;
}
return dump ;
}
document . onkeydown = function ( e ) {
e = e || event ;
keys [ e . keyCode ] = 1 ;
body . innerHTML += dumpObj ( keys ) + "<br />" ;
}
document . onkeyup = function ( e ) {
e = e || event ;
keys [ e . keyCode ] = 0 ;
}
< /script >
< /html >
— ( ):
shift — 16 ctrl — 17 alt — 18 IE , ( ) shift + ctrl — 16+17 shift + alt — 16+18 ctrl + alt — 17+18 Firefox 3.5 shift + ctrl — 16+0 ctrl + shift — 17+0 shift + alt — 16+224 alt + shift — 18+16 ctrl + alt — 17+18 alt + ctrl — 18+17 Chromium 4 shift + ctrl — 16+0 ctrl + shift — 17+0 shift + alt — 16+91 alt + shift — 18+16 ctrl + alt — 17+18 alt + ctrl — 18+17 Opera 10 shift + ctrl — 16 ( Ctrl ) ctrl + shift — 17 ( Shift ) shift + alt — 16+0 alt + shift — 18 ( Shift ) ctrl + alt — 17+18 alt + ctrl — 18 ( Ctrl )
, Meta .
— :
1. «» ? . , — shift+alt
2. ? , , event.shiftKey , . , 224 , 18
3. — , « Handling Keyboard Shortcuts ». , Ctrl/Alt/Shift + . - Space+X C+V+B , .
4. . , , 7 8, .
5. - - ?
. anatoly-rr . , keydown, — keyup , . — , onblur , ?
( )
?
, Windows ? , ? , , , -. , , — .
<! DOCTYPE html >
< html >
< head >
< meta http - equiv = 'content-type' content = 'text/html; charset=utf-8' />
< title > Javascript Event Test </ title >
</ head >
< body ></ body >
< script type = 'text/javascript' > var keys = {};
var body = document . getElementsByTagName ( "body" )[0];
var dumpObj = function ( obj ) {
var dump = "" ;
for (var i in obj ) {
dump += i + ":" + obj [ i ] + "; " ;
}
return dump ;
}
document . onkeydown = function ( e ) {
e = e || event ;
keys [ e . keyCode ] = 1 ;
body . innerHTML += dumpObj ( keys ) + "<br />" ;
}
document . onkeyup = function ( e ) {
e = e || event ;
keys [ e . keyCode ] = 0 ;
}
< /script >
< /html >
— ( ):
shift — 16 ctrl — 17 alt — 18 IE , ( ) shift + ctrl — 16+17 shift + alt — 16+18 ctrl + alt — 17+18 Firefox 3.5 shift + ctrl — 16+0 ctrl + shift — 17+0 shift + alt — 16+224 alt + shift — 18+16 ctrl + alt — 17+18 alt + ctrl — 18+17 Chromium 4 shift + ctrl — 16+0 ctrl + shift — 17+0 shift + alt — 16+91 alt + shift — 18+16 ctrl + alt — 17+18 alt + ctrl — 18+17 Opera 10 shift + ctrl — 16 ( Ctrl ) ctrl + shift — 17 ( Shift ) shift + alt — 16+0 alt + shift — 18 ( Shift ) ctrl + alt — 17+18 alt + ctrl — 18 ( Ctrl )
, Meta .
— :
1. «» ? . , — shift+alt
2. ? , , event.shiftKey , . , 224 , 18
3. — , « Handling Keyboard Shortcuts ». , Ctrl/Alt/Shift + . - Space+X C+V+B , .
4. . , , 7 8, .
5. - - ?
. anatoly-rr . , keydown, — keyup , . — , onblur , ?
( )
?
, Windows ? , ? , , , -. , , — .
<! DOCTYPE html >
< html >
< head >
< meta http - equiv = 'content-type' content = 'text/html; charset=utf-8' />
< title > Javascript Event Test </ title >
</ head >
< body ></ body >
< script type = 'text/javascript' > var keys = {};
var body = document . getElementsByTagName ( "body" )[0];
var dumpObj = function ( obj ) {
var dump = "" ;
for (var i in obj ) {
dump += i + ":" + obj [ i ] + "; " ;
}
return dump ;
}
document . onkeydown = function ( e ) {
e = e || event ;
keys [ e . keyCode ] = 1 ;
body . innerHTML += dumpObj ( keys ) + "<br />" ;
}
document . onkeyup = function ( e ) {
e = e || event ;
keys [ e . keyCode ] = 0 ;
}
< /script >
< /html >
— ( ):
shift — 16 ctrl — 17 alt — 18 IE , ( ) shift + ctrl — 16+17 shift + alt — 16+18 ctrl + alt — 17+18 Firefox 3.5 shift + ctrl — 16+0 ctrl + shift — 17+0 shift + alt — 16+224 alt + shift — 18+16 ctrl + alt — 17+18 alt + ctrl — 18+17 Chromium 4 shift + ctrl — 16+0 ctrl + shift — 17+0 shift + alt — 16+91 alt + shift — 18+16 ctrl + alt — 17+18 alt + ctrl — 18+17 Opera 10 shift + ctrl — 16 ( Ctrl ) ctrl + shift — 17 ( Shift ) shift + alt — 16+0 alt + shift — 18 ( Shift ) ctrl + alt — 17+18 alt + ctrl — 18 ( Ctrl )
, Meta .
— :
1. «» ? . , — shift+alt
2.
3. — , « Handling Keyboard Shortcuts ». , Ctrl/Alt/Shift + . - Space+X C+V+B , .
4. . , , 7 8, .
5. - - ?
. anatoly-rr . , keydown, — keyup , . — , onblur , ?
( )
?
, Windows ? , ? , , , -. , , — .
<! DOCTYPE html >
< html >
< head >
< meta http - equiv = 'content-type' content = 'text/html; charset=utf-8' />
< title > Javascript Event Test </ title >
</ head >
< body ></ body >
< script type = 'text/javascript' > var keys = {};
var body = document . getElementsByTagName ( "body" )[0];
var dumpObj = function ( obj ) {
var dump = "" ;
for (var i in obj ) {
dump += i + ":" + obj [ i ] + "; " ;
}
return dump ;
}
document . onkeydown = function ( e ) {
e = e || event ;
keys [ e . keyCode ] = 1 ;
body . innerHTML += dumpObj ( keys ) + "<br />" ;
}
document . onkeyup = function ( e ) {
e = e || event ;
keys [ e . keyCode ] = 0 ;
}
< /script >
< /html >
— ( ):
shift — 16 ctrl — 17 alt — 18 IE , ( ) shift + ctrl — 16+17 shift + alt — 16+18 ctrl + alt — 17+18 Firefox 3.5 shift + ctrl — 16+0 ctrl + shift — 17+0 shift + alt — 16+224 alt + shift — 18+16 ctrl + alt — 17+18 alt + ctrl — 18+17 Chromium 4 shift + ctrl — 16+0 ctrl + shift — 17+0 shift + alt — 16+91 alt + shift — 18+16 ctrl + alt — 17+18 alt + ctrl — 18+17 Opera 10 shift + ctrl — 16 ( Ctrl ) ctrl + shift — 17 ( Shift ) shift + alt — 16+0 alt + shift — 18 ( Shift ) ctrl + alt — 17+18 alt + ctrl — 18 ( Ctrl )
, Meta .
— :
1. «» ? . , — shift+alt
2. ? , , event.shiftKey , . , 224 , 18
3. — , « Handling Keyboard Shortcuts ». , Ctrl/Alt/Shift + . - Space+X C+V+B , .
4. . , , 7 8, .
5. - - ?
. anatoly-rr . , keydown, — keyup , . — , onblur , ?
( )
?
, Windows ? , ? , , , -. , , — .