Function GetStringutflength (STR) {
VAR value = str.replace (/ [^ / x00- / xff] / g,
"" "
Return Value.Length;
}
Function Leftutfstring (str, len) {
GetStringutflength (STR) <= LEN)
Return Str;
VAR value = str.substring (0, len);
While (GetStringutflength (Value)> LEN) {
Value = value.substring (0, value.length-1);
}
Return Value;
}
Function count () {
VAR value = document.getlementbyid
"licenseother"). Value;
Value = value.Replace (/ [/ u4e00- / u9fa5] / g,
"" "
//alert(Value.length);
IF (Value.Length> = 255) {
With (window.event) {
Cancelbubble =
True;
Keycode = 0;
ReturnValue =
False;
}
Document.getlementByid (
"licenseother"). Value = leftutfstring (Document.GetElementByid)
"licenseother"). Value, 8);
}
Document.getlementByid (
"result"). Value = 255-getStringutFlength (Document.getElementByid)
"licenseother". Value);
}
script>
This input box restricts the input 255 characters (Chinese characters calculated as 2 characters :) td> tr> |