원인

이 스킨에는 단축키 적용이 되어 있었다.

w: /admin/entry/post/
e: /admin/skin/edit/
r: /admin/plugin/refererUrlLog/
h: /

그리고 해당키는 input과 textarea 태그를 제외한 곳에서 입력한 경우 발동되도록 액션이 걸려있다.

문제는 이 스킨의 댓글창은 div태그에 ContentEditable속성을 적용하여 만들어졌던 것이었다.

 

해결

스킨 html 편집을 하고 상단의 스크립트에서 getKey 함수의 if문의 조건을 다음과 같은 방식으로 변경한다.

<script>
    //추가 단축키
    var key = new Array();
    key['w'] = "/admin/entry/post/";
    key['e'] = "/admin/skin/edit/";
    key['r'] = "/admin/plugin/refererUrlLog/";
    key['h'] = "/";

    function getKey(keyStroke) {
      if (((event.srcElement.tagName === 'INPUT') || (event.srcElement.tagName === 'TEXTAREA') || (event.srcElement.tagName === 'DIV' && event.srcElement.isContentEditable))===false) {
        isNetscape = (document.layers);
        eventChooser = (isNetscape) ? keyStroke.which : event.keyCode;
        which = String.fromCharCode(eventChooser).toLowerCase();
        for (var i in key)
          if (which == i) window.location = key[i];
      }
    }
    document.onkeypress = getKey;
  </script>

 

'오류노트' 카테고리의 다른 글

IE 엑셀 다운로드 파일 바로열기 에러  (0) 2015.08.17

+ Recent posts