字符个数:JS控制TEXTAREA框里字符的个数来源: 发布时间:星期三, 2008年9月10日 浏览:175次 评论:0
有时候需要在JS控制TEXTAREA框里字符的个数,下面我们一起看看实现方法。 <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"> function gbcount(message,total,used,remain) </scrīpt> <style type=\"text/css\"> <!-- * {padding:0; margin:0;} body, html {text-align:left; font-size:12px; line-height:150%; margin:0 auto; background:#fff; padding-top:20px;} fieldset {padding:10px; width:550px; margin:0 auto;} legend {font-size:14px; font-weight:bold;} .inputtext {border:none; background:#fff;} --> </style> </head> <body> <form action=\"SaveData.asp\" method=\"post\" ōnSubmit=\"return datacheck();\"> <fieldset><legend>请输入内容</legend> <textarea name=\"Memo\" rows=\"10\" wrap=PHYSICAL cols=\"75\" ōnKeyDown=\"gbcount(this.form.Memo,this.form.total,this.form.used,this.form.remain);\" ōnKeyUp=\"gbcount(this.form.Memo,this.form.total,this.form.used,this.form.remain);\"></textarea> <p>最多字数: <input disabled maxLength=\"4\" name=\"total\" size=\"3\" value=\"200\" class=\"inputtext\"> 已用字数: <input disabled maxLength=\"4\" name=\"used\" size=\"3\" value=\"0\" class=\"inputtext\"> 剩余字数: <input disabled maxLength=\"4\" name=\"remain\" size=\"3\" value=\"200\" class=\"inputtext\"></td>[Page] </p> </fieldset> </form> </body> </html> 0
相关文章
读者评论
发表评论 |