计算可以输入字数 用法
1.第一种
div id="mod_order_remark" style="display:none;"> <div title="#">上海三星数码我友专供</a> <span value="联系我"/> </span> </span> </div> <div name="remork" id="remork" onkeydown='countChar("status","counter");' onkeyup='countChar("remork","counter",this);'> </textarea> <span id="btnConfirm" value="确定" /> </span> <span id="cancelBtn" value="取消" /> </span> </div> </div> </div></div><script> function cal() { if(a.value.length>20) { a.value=a.value.slice(0,20); b.value=20; c.value=0; } else { b.value=a.value.length; c.value=20-eval(b.value); } } </script> <textarea id="a" onpropertychange="cal()"></textarea> 已有字数:<input id=b size=5 value="0" disabled> 剩余字数:<input id=c size=5 value="20" disabled><br>