**** script
<script type="text/javascript">
var setTotalNumberOfWordCounter = "100";
function displayWordCounter(){
var getTextValue = document.frm.dd_fc_comment.value; // Get input textarea value
var getTextLength = getTextValue.length; // Get length of input textarea value
if(getTextLength > setTotalNumberOfWordCounter){ //compare this length with total count
getTextValue = getTextValue.substring(0,setTotalNumberOfWordCounter);
document.frm.dd_fc_comment.value =getTextValue;
return false;
}
document.frm.totalWordLimit.value = (setTotalNumberOfWordCounter-getTextLength);
}
</script>
****html
<form name="frm" method="POST">
<textarea name="dd_fc_comment" class="main_txt_area" onkeyup="return displayWordCounter();"></textarea><br>
<div class="total_count">total remaining Charatctor: <input class="show_count" name="totalWordLimit" size="4" readonly="" value="100" type="text"></div>
</form>


Không có nhận xét nào:
Đăng nhận xét