웹마스터 팁
page_full_width">
웹페이지에서 단축키 사용 (Firefox)
2004.10.07 09:39
예제페이지 : http://www.bexu.com/tt/index.php?pl=211
아래의 소스를 skin.html에 추가하시고..
ar[ar.length] = new hotKey("키", "링크"); 부분을 적당히 수정/추가 하셔서 사용하시면 됩니다.
자료의 출처는 http://korea.internet.com 과 http://www.zog.co.kr 입니다.
두곳의 소스를 합쳐서 지지고 볶아서 만들었습니다.
<SCRIPT LANGUAGE="JavaScript1.2">
<!--
var NS = (window.Event) ? 1 : 0
function checkKey(e) {
//-------- 여기서부터 저 밑에까지
//-------- INPUT / TEXTAREA 폼에서는 단축키 기능 제거
//-------- ZOG 의 JS/INDEX.PHP 에서 따와서 조금 수정
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;
var ar = new Array();
ar[ar.length] = new hotKey("a", "http://daum.net");
ar[ar.length] = new hotKey("A", "http://daum.net");
//대문자와 소문자를 구분하기때문에 모두 작성해주셔야합니다.
//Firefox에서는 영문/한글까지 구분합니다.
ar[ar.length] = new hotKey("n", "http://nzeo.com");
ar[ar.length] = new hotKey("N", "http://nzeo.com"); // -->
</SCRIPT>
아래의 소스를 skin.html에 추가하시고..
ar[ar.length] = new hotKey("키", "링크"); 부분을 적당히 수정/추가 하셔서 사용하시면 됩니다.
자료의 출처는 http://korea.internet.com 과 http://www.zog.co.kr 입니다.
두곳의 소스를 합쳐서 지지고 볶아서 만들었습니다.
<SCRIPT LANGUAGE="JavaScript1.2">
<!--
var NS = (window.Event) ? 1 : 0
function checkKey(e) {
//-------- 여기서부터 저 밑에까지
//-------- INPUT / TEXTAREA 폼에서는 단축키 기능 제거
//-------- ZOG 의 JS/INDEX.PHP 에서 따와서 조금 수정
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;
var ar = new Array();
ar[ar.length] = new hotKey("a", "http://daum.net");
ar[ar.length] = new hotKey("A", "http://daum.net");
//대문자와 소문자를 구분하기때문에 모두 작성해주셔야합니다.
//Firefox에서는 영문/한글까지 구분합니다.
ar[ar.length] = new hotKey("n", "http://nzeo.com");
ar[ar.length] = new hotKey("N", "http://nzeo.com"); // -->
</SCRIPT>
댓글 2
-
치키니aaa
2004.10.07 22:29
-
누구야?
2005.02.21 18:02
엔지오에서는 방식이 조금 다른거같구요
로그인후 바로가기 등록을하면 그 게인마다 달라지는걸루 알고있습니다 ㅠ.ㅜ ..
누가 구현해주세요 ㅠ.ㅜ ... ㅋㅋ ;
2나 3을 눌러보세요.
3을누르니 웹스터디로 이동하는듯하네요..
유용한소스..
웹게임 만들때도 좋은소스 ~