웹마스터 팁

<!-- 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>
제목 글쓴이 날짜
PHP 혼자 공부하기 - 10 :: 정규식 패턴 문법 [3] 행복한고니 2003.04.15
PHP 혼자 공부하기 - 9 :: 정규식 함수 [3] 행복한고니 2003.04.14
[동주아빠] PHP 게시판(21강) - 목록 보기(4) list.php 설명(中) 손병목 2002.12.30
폼메일 --- 제로님 예전 폼메일 수정 변경.. [11] uropa™ 2002.12.27
Java Applet을 활용한 업로드시 전송률 확인하기.. file 아이쿠 2002.10.19
꼭 알아야 하는 4가지 쿼리문 Mr. JH 2002.08.22
누구나 만들수있는 게시판 [글목록 list.php 부분] [6] Mr. JH 2002.08.21
원격침입과 도스공격이 가능한 PHP 취약점 [11] JunYa™ 2002.07.24
php 와 flash 의 연동을 이용한 제로보드 최근글 추출...(소스) file 주현석 2002.06.05
[OsE=] 오스보드에 적용된 페이징 방법(알고리즘?) OsE= 2002.03.02
최근게시물 - 첫글은 내용까지, 다음글부터 목록만... [15] СreдturЭ 2001.04.16
공부용 방명록이에욥^^. 주석왕창(페이지분할등.기능있어욥~) [2] 프리^^ 2001.04.16
최근 게시물을 나타내는 원리와 방법 [55] zero 2000.03.06
교육용 메모장 #4 [18] zero 2000.07.10
카운터를 만들어봅시다~ (수정본) [181] zero 2000.03.08
MYSQL Query의 간단한 사용법 [82] zero 2000.03.06
새로운 뉴스티커 [1] 아렌티 2006.04.25
문자열 길이(byte)에 따라 자르기... 행복한고니 2002.10.11
textarea 입력받는 글자수 제한하는 스크립트 [5] 오기 2002.01.17
자동 스크롤 메뉴 (끄기 기능, 무한 스크롤 X) [6] ☺심심 2004.05.02