//************************************************************//
프로젝트에서 common.js정도에 넣어놓고
숫자만 입력되는 곳에다 이벤트만 걸어주면 됩니다.
//************************************************************//
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<script language="javascript">
window.attachEvent("onload",init) ;
function init()
{
document.getElementById("iValue").attachEvent("onkeyup", iValueHandler) ;
}
function iValueHandler()
{
var element = event.srcElement ;
if(!isNumber(element.value))
{
alert("숫자만 입력하실수 있습니다.");
element.value = "" ;
element.focus() ;
}
}
/*************************************************************************
함수명 : containsCharsOnly
기 능 : 특정문자가 존재하는지 체크
인 수 : input, chars - 객체, 찾고자하는 문자
리턴값 : 존재하면 true
**************************************************************************/
function containsCharsOnly(input,chars) {
for (var inx = 0; inx < input.length; inx++) {
if (chars.indexOf(input.charAt(inx)) == -1)
return false;
}
return true;
}
/*************************************************************************
함수명 : isNumber
기 능 : 입력값이 숫자인지를 체크
인 수 : input - 입력값
리턴값 : 숫자 true , 숫자외문자 false
**************************************************************************/
function isNumber(input) {
var chars = "0123456789.";
if(input == "") return false;
return containsCharsOnly(input,chars);
}
</script>
</HEAD>
<BODY>
<input type="text" name="iValue">
</BODY>
</HTML>
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 7630 | 10년 전 | 633 | ||
| 7629 |
|
10년 전 | 2337 | |
| 7628 | 10년 전 | 768 | ||
| 7627 |
|
10년 전 | 993 | |
| 7626 |
|
10년 전 | 1755 | |
| 7625 | 10년 전 | 654 | ||
| 7624 | 10년 전 | 680 | ||
| 7623 |
|
10년 전 | 3000 | |
| 7622 | 10년 전 | 683 | ||
| 7621 |
leeleeleelee
|
10년 전 | 564 | |
| 7620 | 10년 전 | 524 | ||
| 7619 | 10년 전 | 449 | ||
| 7618 | 10년 전 | 993 | ||
| 7617 | 10년 전 | 711 | ||
| 7616 | 10년 전 | 605 | ||
| 7615 | 10년 전 | 701 | ||
| 7614 | 10년 전 | 1207 | ||
| 7613 |
|
10년 전 | 2046 | |
| 7612 | 10년 전 | 1115 | ||
| 7611 | 10년 전 | 1380 | ||
| 7610 |
|
10년 전 | 1871 | |
| 7609 |
|
10년 전 | 1288 | |
| 7608 |
mwdkim
|
10년 전 | 1092 | |
| 7607 |
|
10년 전 | 1020 | |
| 7606 |
mwdkim
|
10년 전 | 3896 | |
| 7605 | 10년 전 | 664 | ||
| 7604 | 10년 전 | 1002 | ||
| 7603 | 10년 전 | 1625 | ||
| 7602 |
|
10년 전 | 1041 | |
| 7601 |
AniNest
|
10년 전 | 2757 | |
| 7600 |
port443
|
10년 전 | 989 | |
| 7599 | 10년 전 | 915 | ||
| 7598 | 10년 전 | 988 | ||
| 7597 | 10년 전 | 4550 | ||
| 7596 |
SeungYeon
|
10년 전 | 865 | |
| 7595 |
untitled
|
10년 전 | 2385 | |
| 7594 |
프로그래머7
|
10년 전 | 1699 | |
| 7593 |
untitled
|
10년 전 | 2337 | |
| 7592 |
untitled
|
10년 전 | 1906 | |
| 7591 |
untitled
|
10년 전 | 2646 | |
| 7590 |
아리마2001
|
10년 전 | 819 | |
| 7589 | 10년 전 | 1077 | ||
| 7588 |
|
10년 전 | 2893 | |
| 7587 | 10년 전 | 1271 | ||
| 7586 | 10년 전 | 631 | ||
| 7585 | 10년 전 | 1653 | ||
| 7584 | 10년 전 | 1387 | ||
| 7583 |
leeleeleelee
|
10년 전 | 1121 | |
| 7582 |
|
10년 전 | 1069 | |
| 7581 | 10년 전 | 1302 | ||
| 7580 | 10년 전 | 942 | ||
| 7579 |
|
10년 전 | 578 | |
| 7578 | 10년 전 | 1387 | ||
| 7577 |
|
10년 전 | 1849 | |
| 7576 | 10년 전 | 1365 | ||
| 7575 |
멋진남자임
|
10년 전 | 1444 | |
| 7574 | 10년 전 | 2083 | ||
| 7573 | 10년 전 | 3212 | ||
| 7572 | 10년 전 | 744 | ||
| 7571 |
|
10년 전 | 770 | |
| 7570 |
|
10년 전 | 1284 | |
| 7569 | 10년 전 | 1519 | ||
| 7568 |
this1mg
|
10년 전 | 1020 | |
| 7567 |
|
10년 전 | 727 | |
| 7566 | 10년 전 | 888 | ||
| 7565 |
Angel하늘
|
10년 전 | 960 | |
| 7564 |
seoldi
|
10년 전 | 1194 | |
| 7563 |
|
10년 전 | 1345 | |
| 7562 |
멋진남자임
|
10년 전 | 2042 | |
| 7561 | 10년 전 | 679 | ||
| 7560 |
leeleeleelee
|
10년 전 | 876 | |
| 7559 | 10년 전 | 5008 | ||
| 7558 |
RinaP
|
10년 전 | 753 | |
| 7557 |
|
10년 전 | 1216 | |
| 7556 | 10년 전 | 1167 | ||
| 7555 |
hyohyojj1234
|
10년 전 | 1632 | |
| 7554 | 10년 전 | 1067 | ||
| 7553 |
senseme
|
10년 전 | 1321 | |
| 7552 |
ehdltdoit
|
10년 전 | 1413 | |
| 7551 |
|
10년 전 | 1794 | |
| 7550 |
leeleeleelee
|
10년 전 | 1556 | |
| 7549 | 10년 전 | 2392 | ||
| 7548 | 10년 전 | 1812 | ||
| 7547 |
멋진남자임
|
10년 전 | 1919 | |
| 7546 | 10년 전 | 964 | ||
| 7545 |
ILMare1003
|
10년 전 | 1253 | |
| 7544 |
|
10년 전 | 1210 | |
| 7543 | 10년 전 | 860 | ||
| 7542 | 10년 전 | 634 | ||
| 7541 |
울라라라우
|
10년 전 | 845 | |
| 7540 | 10년 전 | 1578 | ||
| 7539 | 10년 전 | 896 | ||
| 7538 |
|
10년 전 | 1807 | |
| 7537 | 10년 전 | 3584 | ||
| 7536 |
Gaumi
|
10년 전 | 1378 | |
| 7535 |
프로그램은어려워
|
10년 전 | 1241 | |
| 7534 |
senseme
|
10년 전 | 1191 | |
| 7533 | 10년 전 | 1164 | ||
| 7532 | 10년 전 | 831 | ||
| 7531 | 10년 전 | 2025 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기