Copy Code code as follows:
text box remaining word tip (character size)
function textlimitchecksj (Thisarea, MaxLength, Spanid) {
var str = thisarea.value;
if (Getchrlen (str, maxLength) > MaxLength * 2) {
Thisarea.value = str.substring (0, x-1);
}
else {
var varss = ' (remaining words: ' + math.floor (maxLength * 2-getchrlen (str, maxLength))/2 + ') ';
document.getElementById (spanid). InnerHTML = Varss;
}
}
function Getchrlen (str, maxLength) {
var reallength = 0, Len = str.length, charcode =-1;
x = 0;
for (; (x < len) && (reallength <=maxlength * 2); X + +) {
CharCode = Str.charcodeat (x);
if (charcode >= 0 && charcode <= 128)
Reallength + 1;
Else
Reallength + 2;
}
return reallength;
}
?
<asp:textbox id= "Txtowner_name" runat= "Server" width= "200px" backcolor= "Lightyellow"
Onkeyup= "TEXTLIMITCHECKSJ (this,50, ' spowner_name ')" ></asp:textbox><span "id="
style= "COLOR: #808080" ><em> (within 50 words) </em></span>