"자바스크립트 onkeydown 이벤트"의 두 판 사이의 차이

25번째 줄: 25번째 줄:
*[[키 입력 받기 (자바스크립트)]]
*[[키 입력 받기 (자바스크립트)]]
*[[백스페이스 막기]]
*[[백스페이스 막기]]
*[[자바스크립트 onkeyup]]


[[분류: 자바스크립트]]
[[분류: 자바스크립트]]
[[분류: 이벤트]]
[[분류: 이벤트]]
[[분류: Window]]
[[분류: Window]]

2013년 10월 26일 (토) 15:18 판

Window.onkeydown

1 소스코드

<!DOCTYPE html>
<meta charset="utf-8" />
<form name='key_form'>
<input type='text' name='key_str' /><br>
<input type='text' name='key_code' /><br>
<input type='reset'/>
</form>
<script>
window.onkeydown = function() {
  key_form.key_code.value += event.keyCode+';';
  key_form.key_str.value += String.fromCharCode(event.keyCode)+';';
}
</script>

2 예제

3 같이 보기

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}