Here is a simple solution.
Assuming you have html code like this
<textarea onKeyPress='return count(this);'></textarea> <input type="text" id="info" value="0/160" />
Note: input / text field identifier is information.
You need the following javascript method
function count(area){ var proceed = area.value.length < 160; document.getElementById('info').value = area.value.length+"/160"; return proceed; }
Note: the identifier of the text field specified in the method, and the size is 160.
source share