<SCRIPT LANGUAGE="JavaScript">
<!--
function Format_Comma(f){
str = f.value;
if(str == ""){
return;
} else {
var newValue = str + "";
var len = newValue.length;
var ch = "";
var j = 1;
var formatValue = "";
len = newValue.length;
for (i = len; i>0; i--){
ch = newValue.substring(i-1, i);
formatValue = ch + formatValue;
if((j % 3) == 0 && i > 1) {
formatValue = "," + formatValue;
}
j++;
}
}
f.value = formatValue;
}
function Delete_Comma(f){
str = f.value;
if(str == ""){
return;
} else {
var result = ""
comma_pattern = /([\,]{1})/;
for(var i = 0; i < str.length; i++) {
if(comma_pattern.test(str.charAt(i))) {
result += str.charAt(i).replace(comma_pattern, "");
} else {
result += str.charAt(i);
}
}
}
f.value = result;
}
function SetNum(obj){
val=obj.value;
re=/[^0-9]/gi;
obj.value=val.replace(re,"");
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<form name="form1">
<input type="text" name="price" size="15" maxlength="10" onkeypress="javascript:SetNum(this)" onblur="javascript:SetNum(this); Format_Comma(this)" onfocus="javascript:Delete_Comma(this)">
</form>
번호 | 제목 | 날짜 | 조회 수 |
---|---|---|---|
14 | Php 어떤 수로 나누어 떨어지는 경우 | ||
13 | Php 숫자 앞의 0 떼어내기 | ||
12 | Php 자릿수 | ||
11 | Php 변수에 특정 문자열이 포함된 경우 처리 | ||
10 | Php 텍스트 값 분리(explode) | ||
9 | Php 날짜 형식 검사 | ||
8 | Php 입력내용이 없이 폼 전송 금지 | ||
7 | Php php 4.x 반올림 에러 문제 해결 | ||
6 | Php 문자열 반복 출력(str_repeat) | ||
5 | Php 문자열에서 이미지 주소만 뽑아내기 | ||
4 | Php 중복입력 확인 | ||
3 | Php date() 함수 사용법 | ||
2 | Php php.ini 수정 | ||
1 | Php 앞 문자 또는 끝 문자 제거 |