Contents

Develop
2003.04.23 10:51

[js] 핫키(단축키) 구현방법

조회 수 7629 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
웹 페이지 상에서 특정 행동을 수행하기 위한 단축 키를 보통 핫 키(Hot Key)라고 부른다. 예를 들어, 현재 페이지 상에서 "k" 키를 누르면 코리아인터넷닷컴 홈페이지로 이동할 수 있도록 스크립트를 작성할 수가 있다. 물론, 응용하기에 따라 다양한 효과를 구현할 수 있을 것이다. 다음과 같은 예를 한 번 살펴 보자: 

<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{ 
        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("k", "http://korea.internet.com/"); 
ar[ar.length] = new hotKey("j", "http://korea.internet.com/channel/list.asp?cid=189&zid=8"); 
ar[ar.length] = new hotKey("h", "http://korea.internet.com/channel/list.asp?cid=187&zid=8"); 

// --> 
</SCRIPT>   

위와 같은 방법으로 다양한 핫키를 정의할 수가 있다. 이런 정의는 인터넷 익스플로러 4.x 이상과 넷스케이프 내비게이터 4.x 이상에서만 사용할 수가 있다.  

현재 페이지에서 j키, h키, k키를 각각 눌러 보기 바란다. 아마도 해당 페이지로 이동하게 될 것이다.


?

  1. [mac] Homebrew/rvm/cocoapod setting

    Date2017.07.29 CategorySystem/OS Byhooni Views1003
    Read More
  2. [mac] Charlesproxy 간단한 설정 내용~

    Date2013.11.12 CategorySystem/OS Byhooni Views12332
    Read More
  3. [macos] How to Fix ‘You Shut Down Your Computer Because of a Problem’

    Date2022.06.01 CategorySystem/OS Byhooni Views794
    Read More
  4. [linux] 한글 URL 인식할 수 있게 아파치(Apache) 설정 (mod_url.c 설치)

    Date2013.04.23 CategorySystem/OS Byhooni Views13067
    Read More
  5. [linux] 프로세스의 stat 상태에 대한 설명

    Date2013.04.23 CategorySystem/OS Byhooni Views10762
    Read More
  6. [linux] 프로세스 상태확인(ps)

    Date2003.04.23 CategorySystem/OS Byhooni Views12711
    Read More
  7. [linux] 프로세스 관련 시스템콜

    Date2003.04.23 CategoryDevelop Byhooni Views7827
    Read More
  8. [linux] 프로그램 설치방법 (내공쌓기)

    Date2003.04.23 CategorySystem/OS Byhooni Views13433
    Read More
  9. [linux] 패킷의 소스 주소 바꾸기

    Date2003.04.23 CategorySystem/OS Byhooni Views18792
    Read More
  10. [linux] 패킷 스니퍼링

    Date2003.04.23 CategorySystem/OS Byhooni Views16323
    Read More
  11. [linux] 파일내 문자열 찾아 바꾸기

    Date2013.04.23 CategorySystem/OS Byhooni Views12195
    Read More
  12. [linux] 특정 문자열 포함된 파일 찾는 명령어

    Date2013.10.16 CategorySystem/OS Byhooni Views30618
    Read More
Board Pagination Prev 1 ... 21 22 23 24 25 26 27 28 29 30 ... 98 Next
/ 98