To Calculate number of chars in a text box


Calculate and display the number of characters within a TEXTAREA with this script. Useful, for example, in helping your visitors manually keep their input length in check!

<form method="POST">
<table border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td width="100%">
<textarea rows="12" name="charcount" cols="60" wrap="virtual"></textarea>
      </td>
    </tr>
    <tr>
      <td width="100%"><div align="right"><p><input type="button" value="Calculate Characters"
      onClick="countit(this)"> <input type="text" name="displaycount" size="20"></p>
      <div align="center"><center>
      </center></div></div></td>
    </tr>
  </table>

</form>

<script language="JavaScript">

function countit(what){

formcontent=what.form.charcount.value
what.form.displaycount.value=formcontent.length
}
</script>

Comments

Popular Posts