웹 문서에서 Hot Key 사용하기 > script

본문 바로가기

script

웹 문서에서 Hot Key 사용하기

작성일 07-08-08 11:24

페이지 정보

작성자서방님 조회 662회 댓글 0건

본문

<SCRIPT LANGUAGE="JavaScript1.2">
<!--

var NS = (window.Event) ? 1 : 0;

function checkKey(e) {
var code = (NS) ? e.which : event.keyCode;
var key = String.fromCharCode(code);
for (var i = 0; i < ar.length; i++) {
if (key == ar[i].key) location.href = ar[i].url;
}
}

function hotKey(key, url) {
this.key = key;
this.url = url;
}

if (NS) document.captureEvents(Event.KEYPRESS)
document.onkeypress = checkKey;

var ar = new Array();
ar[ar.length] = new hotKey("h", "http://www.jasko.co.kr/");
ar[ar.length] = new hotKey("m", "http://www.microsoft.com/");
ar[ar.length] = new hotKey("d", "http://www.daum.net/");

// -->
</SCRIPT>

 

댓글목록

등록된 댓글이 없습니다.

게시물 검색
Copyright © 서방님.kr All rights reserved.
PC 버전으로 보기