한글만 입력되게

  1. <SCRIPT LANGUAGE="JavaScript">   
  2. <!--   
  3.     function enforceHanGul() {   
  4.        if(window.event.type == "propertychange" ){   
  5.           if ( window.event.propertyName == "value" ) {   
  6.               //var pattern = /[^(ㄱ-힣)]|[-/\s]/g;    
  7.                 var pattern = /[^(ㄱ-힣)]/g;    
  8.                 if(pattern.test(window.event.srcElement.value)){   
  9.                     var v = window.event.srcElement.value.replace(pattern, "");   
  10.                     window.event.srcElement.value = window.event.srcElement.value.replace(pattern, "");   
  11.                 }   
  12.           }   
  13.        }   
  14.     }   
  15. //-->   
  16. </SCRIPT>   
  17. 한글만 입력되게, 마우스 붙여넣기 막힘   
  18. <input style="ime-mode:active" onfocus="this.style.imeMode='active'" onkeydown="this.focus()" onpropertychange='enforceHanGul()'>
[이 게시물은 관리자님에 의해 2011-10-31 17:16:08 PHP & HTML에서 이동 됨]
|

댓글 1개

어,, 필요했었는데,,, 감사
반대로 영문만 입력하게 되려면 어떻게 하죠???
댓글을 작성하시려면 로그인이 필요합니다. 로그인

개발자팁

개발과 관련된 유용한 정보를 공유하세요. 질문은 QA에서 해주시기 바랍니다.

+
분류 제목 글쓴이 날짜 조회
jQuery 17년 전 조회 6,021
jQuery 17년 전 조회 4,414
기타 17년 전 조회 2,878
기타 17년 전 조회 2,232
jQuery 17년 전 조회 5,737
jQuery 17년 전 조회 3,036
jQuery 17년 전 조회 2,948
기타 17년 전 조회 3,257
jQuery 17년 전 조회 2,561
jQuery 17년 전 조회 7,179
MySQL 17년 전 조회 3,282
기타 17년 전 조회 4,597
jQuery 17년 전 조회 4,549
기타 17년 전 조회 2,023
JavaScript 17년 전 조회 2,776
기타 17년 전 조회 2,845
기타 17년 전 조회 3,720
jQuery 17년 전 조회 4,412
JavaScript 17년 전 조회 5,061
jQuery 17년 전 조회 4,762
jQuery 17년 전 조회 5,678
기타 17년 전 조회 2,346
jQuery
[jQuery]
17년 전 조회 3,097
기타 17년 전 조회 3,379
MySQL 17년 전 조회 3,565
MySQL 17년 전 조회 3,785
jQuery 17년 전 조회 4,949
jQuery 17년 전 조회 3,615
jQuery 17년 전 조회 2,953
jQuery 17년 전 조회 5,716
🐛 버그신고