textarea에 입력된 길이만큼 게이지로 표현
<script language="JavaScript">
<!--
function textCounter(field,counter,maxlimit,linecounter) {
var fieldWidth = parseInt(field.style.width);
var charcnt = field.value.length;
if(charcnt > maxlimit) {
field.value = field.value.substring(0, maxlimit);
} else {
var percentage = parseInt(100 - (( maxlimit - charcnt) * 100)/maxlimit) ;
document.getElementById(counter).style.width = parseInt((fieldWidth*percentage)/100)+"px";
setcolor(document.getElementById(counter),percentage,"background-color");
}
}
function setcolor(obj,percentage,prop){
obj.style[prop] = "rgb(80%,"+(100-percentage)+"%,"+(100-percentage)+"%)";
}
// 페이지 로드시 명령
textCounter(document.getElementById("maxcharfield"),"progressbar1",200);
//-->
</script>
<!--
textarea에서 onkeydown,onkeyup,onfocus의 명령의 설명
textCounter(this,1,2);
this : 현재 textarea의 name값과 같음
1 : 게이지가 보여질 부분의 id값
2 : textarea에 입력 가능한 최대 글자수
** textarea에서 가로크기는 꼭 style로 해야함 cols는 안됨..
//-->
<textarea style="width:300px" rows="5" name="maxcharfield" onKeyDown="textCounter(this,'progressbar1',200);" onKeyUp="textCounter(this,'progressbar1',200);" onFocus="textCounter(this,'progressbar1',200);">
</textarea>
<!-- 입력 길이를 표시하는 게이지 //-->
<div id="progressbar1" style="width:1px; height:2px; background-color:#DFDFFF;"></div><div class='small'>[이 게시물은 관리자님에 의해 2011-10-31 16:57:14 JavaScript에서 이동 됨]</div>
<!--
function textCounter(field,counter,maxlimit,linecounter) {
var fieldWidth = parseInt(field.style.width);
var charcnt = field.value.length;
if(charcnt > maxlimit) {
field.value = field.value.substring(0, maxlimit);
} else {
var percentage = parseInt(100 - (( maxlimit - charcnt) * 100)/maxlimit) ;
document.getElementById(counter).style.width = parseInt((fieldWidth*percentage)/100)+"px";
setcolor(document.getElementById(counter),percentage,"background-color");
}
}
function setcolor(obj,percentage,prop){
obj.style[prop] = "rgb(80%,"+(100-percentage)+"%,"+(100-percentage)+"%)";
}
// 페이지 로드시 명령
textCounter(document.getElementById("maxcharfield"),"progressbar1",200);
//-->
</script>
<!--
textarea에서 onkeydown,onkeyup,onfocus의 명령의 설명
textCounter(this,1,2);
this : 현재 textarea의 name값과 같음
1 : 게이지가 보여질 부분의 id값
2 : textarea에 입력 가능한 최대 글자수
** textarea에서 가로크기는 꼭 style로 해야함 cols는 안됨..
//-->
<textarea style="width:300px" rows="5" name="maxcharfield" onKeyDown="textCounter(this,'progressbar1',200);" onKeyUp="textCounter(this,'progressbar1',200);" onFocus="textCounter(this,'progressbar1',200);">
</textarea>
<!-- 입력 길이를 표시하는 게이지 //-->
<div id="progressbar1" style="width:1px; height:2px; background-color:#DFDFFF;"></div><div class='small'>[이 게시물은 관리자님에 의해 2011-10-31 16:57:14 JavaScript에서 이동 됨]</div>
게시글 목록
| 번호 | 제목 |
|---|---|
| 394 |
HTML
테이블안에 있는 글 자동 정렬하기
1
|
| 393 | |
| 389 | |
| 388 | |
| 387 |
HTML
전체화면으로 페이지 열기
|
| 386 | |
| 385 | |
| 383 |
HTML
오늘 날짜와 요일 넣기
1
|
| 381 |
HTML
창의 사이즈 변경 금지 시키기
1
|
| 380 |
HTML
손님의 방문 횟수를 알려 줍니다
|
| 379 |
HTML
자바스크립트 버튼에 링크 걸기
|
| 378 |
HTML
이름을 물어보고 인사하는 스크립트
|
| 377 | |
| 371 | |
| 370 |
HTML
버튼에 스타일주기(익스)
|
| 369 |
HTML
오른쪽마우스클릭시메뉴(익스전용)
|
| 368 |
HTML
오른쪽마우스클릭시메뉴(익스전용)
|
| 367 |
HTML
영카트에서 카테고리 검색하기
|
| 366 |
HTML
자바스크립트로 url 획득
|
| 362 | |
| 359 |
HTML
투명도조절
2
|
| 358 | |
| 357 |
HTML
버튼 하나로 링크두개를 열어보자
|
| 356 |
HTML
[펌]다중 업로드
|
| 350 | |
| 349 | |
| 344 |
HTML
밑의 갤러리 압축 화일
4
|
| 343 | |
| 342 | |
| 341 |
HTML
cart클래스2
|
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기