<html> <head> <title> New Title </title>
<!--- [1´Ü°è] ¾Æ·¡ÀÇ ¼Ò½ºÄڵ带 <head>¿Í </head> »çÀÌ¿¡ ºÙ¿© ³ÖÀ¸¼¼¿ä ---------------------->
<style type="text/css"> .progress{ width: 1px; height: 14px; color: white; font-size: 12px; overflow: hidden; background-color: navy; /*¹ÙÀÇ ¹è°æ»ö»ó*/ padding-left: 5px; } </style>
<script type="text/JavaScript">
function textCounter(field,counter,maxlimit,linecounter) { var fieldWidth = parseInt(field.offsetWidth); 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"; document.getElementById(counter).innerHTML="Limit: "+percentage+"%" setcolor(document.getElementById(counter),percentage,"background-color"); } }
function setcolor(obj,percentage,prop){ obj.style[prop] = "rgb(80%,"+(100-percentage)+"%,"+(100-percentage)+"%)"; }
</script>
<!------ ¿©±â±îÁö [1´Ü°è ³¡] ----------->
</head>
<body>
<!------ [2´Ü°è] ¾Æ·¡¿Í °°Àº ¹æ¹ýÀ¸·Î ¿øÇÏ´Â °÷¿¡ Äڵ带 ÀÔ·ÂÇϼ¼¿ä --------> <!------ ¾Æ·¡¿¡¼ 20 À̶ó´Â ¼ýÀÚ´Â ³ÖÀ»¼ö ÀÖ´Â ±ÛÀÚ¼ö Á¦ÇÑÀ» ¶æÇÕ´Ï´Ù ------->
¾Æ·¡ ¿µ¿ª¿¡ ±ÛÀÚ¸¦ ÀÔ·Â ÇØ º¸¼¼¿ä
<form>
<textarea rows="5" cols="40" name="maxcharfield" id="maxcharfield" onKeyDown="textCounter(this,'progressbar1',20)" onKeyUp="textCounter(this,'progressbar1',20)" onFocus="textCounter(this,'progressbar1',20)" ></textarea><br />
<div id="progressbar1" class="progress"></div>
<script>textCounter(document.getElementById("maxcharfield"),"progressbar1",20)</script>
</form>
<!------ ¿©±â±îÁö [2´Ü°è ³¡] ----------->
</body> </html>
|