var x = "", e = null; function cntChars(t, n) { window.document.forms[t].text.value.length > n ? window.document.forms[t].text.value = x : x = window.document.forms[t].text.value, null == e ? e = document.getElementById("cntChars") : e.childNodes[0].data = window.document.forms[t].text.value.length } function cntchar(t) { window.document.forms[0].text.value.length > t ? window.document.forms[0].text.value = x : x = window.document.forms[0].text.value, null == e ? e = document.getElementById("cntChars") : e.childNodes[0].data = window.document.forms[0].text.value.length }