웹마스터 팁
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
textarea 입력받는 글자수 제한하는 스크립트
2002.01.17 19:53
<!-- TWO STEPS TO INSTALL LIMIT TEXTAREA:
<!-- textarea의 입력 제한 설치 2단계 -->
1. Copy the coding into the HEAD of your HTML document
<!-- //1. html의 head에 소스를 넣어준다. -->
2. Add the last code into the BODY of your HTML document -->
<!-- //2. html의 body에 소스를 넣어준다. -->
<!-- STEP ONE: Paste this code into the HEAD of your HTML document -->
<!-- //1단계 : html의 head에 아래의 소스를 넣어라. -->
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Ronnie T. Moore -->
<!-- Web Site: The JavaScript Source -->
<!-- //원작자와 사이트명 -->
<!-- Dynamic 'fix' by: Nannette Thacker -->
<!-- Web Site: http://www.shiningstar.net -->
<!-- //수정한사람과 사이트명 -->
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- //이곳에 더많은 좋은 정보가 있다. -->
<!-- Begin
function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else
countfield.value = maxlimit - field.value.length;
}
End -->
<!-- // textcounter 함수의 시작과 끝, 위의 부분을 head에 넣어줌 -->
</script>
</HEAD>
<!-- STEP TWO: Copy this code into the BODY of your HTML document -->
<!-- //2단계 : html의 body에 아래의 코드를 넣어라. -->
<BODY>
<!-- textCounter() parameters are: text field, the count field, max length -->
<!-- //textcounter()에 사용되는 것들 : 텍스트필드, 카운트필드, 최대입력수 -->
<!-- //여기서부터는 위의 스크립트를 사용한 예제임(125자로 제한). 알맞게 수정하면 됨.... -->
<center>
<form name=myform action="YOUR-SCRIPT.CGI">
<font size="1" face="arial, helvetica, sans-serif"> ( You may enter up to 125 characters. )<br>
<textarea name=message wrap=physical cols=28 rows=4 onKeyDown="textCounter(this.form.message,this.form.remLen,125);" onKeyUp="textCounter(this.form.message,this.form.remLen,125);"></textarea>
<br>
<input readonly type=text name=remLen size=3 maxlength=3 value="125"> characters left</font>
<!-- 몇자남았는지카운트해주는부분 -->
</form>
</center>
<p><center>
<font face="arial, helvetica" SIZE="-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>
<!-- Script Size: 1.37 KB -->
쉽게 말해서 head에 이걸 넣어줍니다.
<SCRIPT LANGUAGE="JavaScript">
function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else
countfield.value = maxlimit - field.value.length;
}
</script>
body에는 위의 예처럼 사용합니다. (맞게 수정하시면 됩니다.)
<form name=myform action="YOUR-SCRIPT.CGI">
<font size="1" face="arial, helvetica, sans-serif"> ( You may enter up to 125 characters. )<br>
<textarea name=message wrap=physical cols=28 rows=4 onKeyDown="textCounter(this.form.message,this.form.remLen,125);" onKeyUp="textCounter(this.form.message,this.form.remLen,125);"></textarea>
<br>
<input readonly type=text name=remLen size=3 maxlength=3 value="125"> characters left</font>
</form>
<!-- textarea의 입력 제한 설치 2단계 -->
1. Copy the coding into the HEAD of your HTML document
<!-- //1. html의 head에 소스를 넣어준다. -->
2. Add the last code into the BODY of your HTML document -->
<!-- //2. html의 body에 소스를 넣어준다. -->
<!-- STEP ONE: Paste this code into the HEAD of your HTML document -->
<!-- //1단계 : html의 head에 아래의 소스를 넣어라. -->
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Ronnie T. Moore -->
<!-- Web Site: The JavaScript Source -->
<!-- //원작자와 사이트명 -->
<!-- Dynamic 'fix' by: Nannette Thacker -->
<!-- Web Site: http://www.shiningstar.net -->
<!-- //수정한사람과 사이트명 -->
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- //이곳에 더많은 좋은 정보가 있다. -->
<!-- Begin
function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else
countfield.value = maxlimit - field.value.length;
}
End -->
<!-- // textcounter 함수의 시작과 끝, 위의 부분을 head에 넣어줌 -->
</script>
</HEAD>
<!-- STEP TWO: Copy this code into the BODY of your HTML document -->
<!-- //2단계 : html의 body에 아래의 코드를 넣어라. -->
<BODY>
<!-- textCounter() parameters are: text field, the count field, max length -->
<!-- //textcounter()에 사용되는 것들 : 텍스트필드, 카운트필드, 최대입력수 -->
<!-- //여기서부터는 위의 스크립트를 사용한 예제임(125자로 제한). 알맞게 수정하면 됨.... -->
<center>
<form name=myform action="YOUR-SCRIPT.CGI">
<font size="1" face="arial, helvetica, sans-serif"> ( You may enter up to 125 characters. )<br>
<textarea name=message wrap=physical cols=28 rows=4 onKeyDown="textCounter(this.form.message,this.form.remLen,125);" onKeyUp="textCounter(this.form.message,this.form.remLen,125);"></textarea>
<br>
<input readonly type=text name=remLen size=3 maxlength=3 value="125"> characters left</font>
<!-- 몇자남았는지카운트해주는부분 -->
</form>
</center>
<p><center>
<font face="arial, helvetica" SIZE="-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>
<!-- Script Size: 1.37 KB -->
쉽게 말해서 head에 이걸 넣어줍니다.
<SCRIPT LANGUAGE="JavaScript">
function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else
countfield.value = maxlimit - field.value.length;
}
</script>
body에는 위의 예처럼 사용합니다. (맞게 수정하시면 됩니다.)
<form name=myform action="YOUR-SCRIPT.CGI">
<font size="1" face="arial, helvetica, sans-serif"> ( You may enter up to 125 characters. )<br>
<textarea name=message wrap=physical cols=28 rows=4 onKeyDown="textCounter(this.form.message,this.form.remLen,125);" onKeyUp="textCounter(this.form.message,this.form.remLen,125);"></textarea>
<br>
<input readonly type=text name=remLen size=3 maxlength=3 value="125"> characters left</font>
</form>
댓글 5
-
박신용
2002.01.20 04:23
ㅡ,.ㅡ 영어무지 잘하시네여..초보를 위해 올리셨다면 설명은 좀 한글로 쓰시던가 초보들 보기엔 다 프로그램인지 알것네....헉시 한글 몰르심 멀라두.. -
오기
2002.01.20 13:41
http://javascript.internet.com/forms/limit-textarea.html
이 소스를 가져온 페이지 입니다.
<!-- -->는 주석이고 이 부분을 제외하면 실제 소스는 얼마 되지 않습니다.
나머지 소스도 태그만 아시면 이해가 어렵지 않구요...
영어 못하지만 여기에 달린 영어로된 주석이 어렵다고는 생각 안합니다. ㅡ.ㅡ -
WOWpc
2002.01.28 04:04
한글도 1 문자로 인식하는데 문제가 있군요.
한글은 2 byte 로 처리해야 하는데 말이죠..
외국애들이 만든거라 어쩔 수 없나봅니다. -
김의주
2002.01.30 11:01
오... 이런건 그냥 문자(SMS)보내는 거에서 따서오면 되요 --; -
김동빈
2003.01.12 23:32
한글은 제한 안됩니다...
제목 | 글쓴이 | 날짜 |
---|---|---|
아파치 httpd.conf 2차 설정본 - php 연동 | 이성헌 | 2005.12.15 |
php 4.3.2 의 php.ini 내용 (내컴 설치본) | 이성헌 | 2005.12.15 |
apache httpd.conf 의 1차 설치본 - alias 사용 | 이성헌 | 2005.12.15 |
아파치 인증에서 .htaccess 의 내용. | 이성헌 | 2005.12.15 |
wo.to (유료서버) 의 아파치 폴더 인증 방법. | 이성헌 | 2005.12.15 |
아파치 설정 활용 예(서비스 제한측면) [4] | 좋은진호 | 2005.01.31 |
FTP서버설치 (filezilla server) [6] | 이주성 | 2004.05.20 |
리눅스 커널(kernel)에 심각한 보안 결함 발견 [1] | 아치 | 2003.12.04 |
안전한 FTP, vsftpd 설치와 운영 (한글로그 패치 포함) [1] | 좋은진호 | 2003.10.15 |
apache-1.3.28 release [5] | 아치™ | 2003.09.19 |
apache 서버에서 디렉토리 보기 방지. [5] | 이성헌 | 2003.06.08 |
apache 서버에서 apache 인증 (윈도우에서 apm 설치후) | 이성헌 | 2003.06.05 |
트래픽관리 Throttle-status 사용자 인증시키기 [1] | Cksoft | 2003.03.18 |
apache-1.3.x설치⑤ (apahce설치, php가속기 추가) | 비츠로 | 2003.03.02 |
apache-1.3.x설치① (필수조건과 pre configure) | 비츠로 | 2003.03.02 |
qmail-1.03설치⑧ (squirrel웹메일과 연동) | 비츠로 | 2003.02.28 |
qmail-1.03설치⑤ (courier-imap연동) | 비츠로 | 2003.02.28 |
phpMyAdmin 보안설정하기 [5] | 겨울늑대 | 2003.02.27 |
htaccess를 활용하자 3탄! 사용자인증 [4] | [쿨럭]블루엔젤 | 2003.01.23 |
무료 호스팅 서버 만들기 -4부 [18] | 장동민 | 2003.01.04 |