效果图<!DOCTYPEHTMLPUBLIC"-//W3C//DTDHTML4.01Transitional//EN""http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd"><HTMLxmlns="http://www.w3.org/1999/xhtml"><HEAD>&am

html输入框输入显示剩余字数 html输入框输入显示剩余字数(html输入框只能输入数字)  第1张 效果图

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd"><HTML xmlns="http://www.w3.org/1999/xhtml"><HEAD><TITLE></TITLE><LINK href="css/User_Login.css" type=text/css rel=stylesheet><META http-equiv=Content-Type content="textml; charset=utf-8"><script type="text/javascript" src="jquery-1.7.2.min.js"></script> </HEAD> <script type="text/javascript"> $().ready(function(){var ty = document.getElementById("cty");var motto=document.getElementById("motto");var curLen=document.getElementById("curLen");var maxLen=document.getElementById("maxLen");var leftLen=document.getElementById("leftLen");motto.onkeyup= function () {maxLength = parseInt(maxLen.firstChild.nodeValue);this.value = this.value.substr(0,maxLength);var len = this.value.length;curLen.firstChild.nodeValue = len;leftLen.firstChild.nodeValue = maxLength-len;}; //shade(ty);});

 

</script><BODY><label> <textarea name="motto" >200</span>字! </em></label></BODY></HTML>

 

转载请说明出处
知优网 » html输入框输入显示剩余字数(html输入框只能输入数字)

发表评论

您需要后才能发表评论