Posted in Javascript onApril 01, 2014
<input name="title" type="text" size="50" value="{$p.title}" maxlength="15" onkeyup="javascript:setShowLength(this, 15, 'cost_tpl_title_length');"><span class="red" id="cost_tpl_title_length">还可以输入15字数</span>
js:
function setShowLength(obj, maxlength, id) { var rem = maxlength - obj.value.length; var wid = id; if (rem < 0){ rem = 0; } document.getElementById(wid).innerHTML = "还可以输入" + rem + "字数"; }
动态显示可输入的字数提示还可以输入的字数
声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@