Js控制输入字符数限制

function ismaxlength(obj){ 
    var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : "" 
    if (obj.getAttribute && obj.value.length>mlength) 
    obj.value=obj.value.substring(0,mlength) 
} 
2008-01-23 14:20 147 javascript