input 에 자연수 및 정수만 입력

자연수만 입력

<script>
function myint(numint){
if(numint.value-parseInt(numint.value)!='0'||numint.value<0) numint.value='';
}
</script>

<input onmouseout=myint(this)>

-----

정수만 입력

<script>
function myint(numint){
if(numint.value-parseInt(numint.value)!='0') numint.value='';
}
</script>

<input onmouseout=myint(this)><div class='small'>[이 게시물은 관리자님에 의해 2011-10-31 16:57:14 JavaScript에서 이동 됨]</div>
|

댓글 1개

정수만 입력 받기에는 이게 더 편할꺼 같은데요 ^^
onkeyPress="if ((event.keyCode<48) || (event.keyCode>57)) event.returnValue=false;"style="ime-mode:disabled"
댓글을 작성하시려면 로그인이 필요합니다.

팁게시판

디자인과 관련된 유용한 정보를 공유하세요. 질문은 상단의 QA에서 해주시기 바랍니다.

+
제목 글쓴이 날짜 조회
14년 전 조회 2,743
14년 전 조회 1,214
14년 전 조회 811
14년 전 조회 1,224
14년 전 조회 655
14년 전 조회 926
14년 전 조회 1,576
14년 전 조회 1,030
14년 전 조회 1,259
14년 전 조회 947
14년 전 조회 1,642
14년 전 조회 1,232
14년 전 조회 1,393
14년 전 조회 833
14년 전 조회 848
14년 전 조회 1,408
14년 전 조회 2,327
14년 전 조회 2,237
14년 전 조회 1,866
14년 전 조회 1,262
14년 전 조회 1,534
14년 전 조회 1,276
14년 전 조회 1,971
14년 전 조회 741
14년 전 조회 2,537