function checkLen(obj,maxChar)
{
var maxChars = maxChar;
if (obj.value.length > maxChars){
obj.value = obj.value.substring(0,maxChars);
alert("最多输入"+maxChars+"字符");
var curr = maxChars - obj.value.length;
document.getElementById("count").value = curr.toString();
}
}
JS控制字符串
最新推荐文章于 2024-02-28 23:56:32 发布