텍스트박스의 단어수/ 글자수 체크 스크립트 > script

본문 바로가기
사이트 내 전체검색

script

텍스트박스의 단어수/ 글자수 체크 스크립트

페이지 정보

작성자 서방님 댓글 0건 조회 188회 작성일 06-09-12 17:55

본문

<SCRIPT LANGUAGE="JavaScript">

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!!
http://javascript.internet.com -->

<!-- Begin
   var submitcount=0;
   function checkSubmit() {

      if (submitcount == 0)
      {
      submitcount++;
      document.Surv.submit();
      }
   }


function wordCounter(field, countfield, maxlimit) {
wordcounter=0;
for (x=0;x<field.value.length;x++) {
      if (field.value.charAt(x) == " " && field.value.charAt(x-1) != " ")  {wordcounter++}  // Counts the spaces while ignoring double spaces, usually one in between each word.
      if (wordcounter > 250) {field.value = field.value.substring(0, x);}
      else {countfield.value = maxlimit - wordcounter;}
      }
   }

function textCounter(field, countfield, maxlimit) {
  if (field.value.length > maxlimit)
      {field.value = field.value.substring(0, maxlimit);}
      else
      {countfield.value = maxlimit - field.value.length;}
  }
//  End -->
</script>

<BODY>

<FORM NAME=Surv>

[단어수체크]

<textarea name="Q3367" cols="40" rows="5" wrap="hard" onKeyDown="wordCounter(this.form.Q3367,this.form.remLen,100);" onKeyUp="wordCounter(this.form.Q3367,this.form.remLen,100);"></textarea>

[글자수체크]

<textarea name="Q336" cols="40" rows="5" wrap="hard" onKeyDown="textCounter(this.form.Q336,this.form.remLentext,100);" onKeyUp="textCounter(this.form.Q336,this.form.remLentext,100);"></textarea>

</FORM>

</BODY>

첨부파일

댓글목록

등록된 댓글이 없습니다.

회원로그인

접속자집계

오늘
117
어제
225
최대
1,347
전체
154,876
Latest Crypto Fear & Greed Index

그누보드5
Copyright © 서방님.kr All rights reserved.