한글만 입력되게

  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,020
jQuery 17년 전 조회 4,413
기타 17년 전 조회 2,875
기타 17년 전 조회 2,231
jQuery 17년 전 조회 5,736
jQuery 17년 전 조회 3,034
jQuery 17년 전 조회 2,947
기타 17년 전 조회 3,256
jQuery 17년 전 조회 2,560
jQuery 17년 전 조회 7,178
MySQL 17년 전 조회 3,280
기타 17년 전 조회 4,596
jQuery 17년 전 조회 4,548
기타 17년 전 조회 2,022
JavaScript 17년 전 조회 2,775
기타 17년 전 조회 2,844
기타 17년 전 조회 3,719
jQuery 17년 전 조회 4,410
JavaScript 17년 전 조회 5,059
jQuery 17년 전 조회 4,760
jQuery 17년 전 조회 5,676
기타 17년 전 조회 2,346
jQuery
[jQuery]
17년 전 조회 3,095
기타 17년 전 조회 3,378
MySQL 17년 전 조회 3,563
MySQL 17년 전 조회 3,783
jQuery 17년 전 조회 4,947
jQuery 17년 전 조회 3,613
jQuery 17년 전 조회 2,952
jQuery 17년 전 조회 5,714
🐛 버그신고