http://clien.career.co.kr/zboard/view.php?id=lecture&no=4179
- 대소문자를 구별
- 익스플로러와 파이어폭스에서 정상동작
<script language="JavaScript1.2">
var ar = new Array();
ar[ar.length] = new hotKey("H", "http://domain.com/board/?mid=home");
ar[ar.length] = new hotKey("h", "http://domain.com/board/?mid=home");
ar[ar.length] = new hotKey("F", "http://domain.com/board/?mid=freeboard");
ar[ar.length] = new hotKey("f", "http://domain.com/board/?mid=freeboard");
ar[ar.length] = new hotKey("P", "http://domain.com/board/?mid=photogallery");
ar[ar.length] = new hotKey("p", "http://domain.com/board/?mid=photogallery");
var NS = (window.Event) ? 1 : 0
function checkKey(e) {
if (e == null) {
code = event.keyCode;
if(event.srcElement.tagName == "INPUT" || event.srcElement.tagName == "TEXTAREA") return true;
}
else {
if (e.altKey || e.ctrlKey) {
return true;
}
if(e.target.tagName == "INPUT" || e.target.tagName == "TEXTAREA") return;
code = e.which;
}
key = String.fromCharCode(code).toLowerCase();
if(code==13) key="enter";
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;
</script>
- 대소문자를 구별
- 익스플로러와 파이어폭스에서 정상동작
<script language="JavaScript1.2">
var ar = new Array();
ar[ar.length] = new hotKey("H", "http://domain.com/board/?mid=home");
ar[ar.length] = new hotKey("h", "http://domain.com/board/?mid=home");
ar[ar.length] = new hotKey("F", "http://domain.com/board/?mid=freeboard");
ar[ar.length] = new hotKey("f", "http://domain.com/board/?mid=freeboard");
ar[ar.length] = new hotKey("P", "http://domain.com/board/?mid=photogallery");
ar[ar.length] = new hotKey("p", "http://domain.com/board/?mid=photogallery");
var NS = (window.Event) ? 1 : 0
function checkKey(e) {
if (e == null) {
code = event.keyCode;
if(event.srcElement.tagName == "INPUT" || event.srcElement.tagName == "TEXTAREA") return true;
}
else {
if (e.altKey || e.ctrlKey) {
return true;
}
if(e.target.tagName == "INPUT" || e.target.tagName == "TEXTAREA") return;
code = e.which;
}
key = String.fromCharCode(code).toLowerCase();
if(code==13) key="enter";
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;
</script>
'정보기술 > 일반' 카테고리의 다른 글
김중태 - 웹2.0 시대의 기회, 시맨틱웹 (0) | 2008.08.26 |
---|---|
iPod에 가요/Pop/J-Pop 가사 자동 입력 (0) | 2008.07.25 |
Warelex Mobiola WebCam Bluetooth (0) | 2008.06.13 |
Polycom Video Test Numbers (0) | 2008.06.07 |
RedHat Linux Package 관리 (0) | 2008.06.06 |