텍스트박스의 단어수/ 글자수 체크 스크립트
페이지 정보
작성자 서방님 댓글 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>
첨부파일
- 텍스트박스의_글자수체크.html (3.2K) 2회 다운로드 | DATE : 2008-09-08 11:41:03
댓글목록
등록된 댓글이 없습니다.