상세 컨텐츠

본문 제목

Javascript KeyCode Reference table for Event Handling

자바스크립트

by happynuri 2009. 2. 11. 16:22

본문

  자바 스크립트에서 키코드를 이용해서 메소드를 작성할때

if(event.KeyCode == 13)
{
엔터치면 일어나는 일
}
요런식으로 이벤트 핸들링 하면 된다는것..

아래는 링크이며, 더보기를 하면 키코드가 나옵니다.

http://protocolsofmatrix.blogspot.com/2007/09/javascript-keycode-reference-table-for.html

The post explains Keyboard event handling using javascript.Javascript events are used to capture user keystrokes.

Below is a table of key codes for the keys on a multimedia keyboard. If this table is inconsistent with your own  own findings, please let me know.

Java Script Code to Find Key code

<script language="JavaScript">
document.onkeydown = checkKeycode
function checkKeycode(e) {
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
alert("keycode: " + keycode);
}
</script>

관련글 더보기

댓글 영역