根据输入文本提示剩余数字个数
<script type="text/javascript">
function checkLength(which,lb) {
var maxChars = 312; //
if (which.value.length > maxChars)
{
// 超过限制的字数了就将 文本框中的内容按规定的字数 截取
which.value = which.value.substring(0,maxChars);
return false;
}
else
{
var curr = maxChars - which.value.length; //250 减去 当前输入的
// alert(document.getElementById("sy"));
if(lb==1)
{
document.getElementById("tabID_tabpID_ctlxswxInfo1_sy").innerHTML = curr.toString();
}
else if(lb==2)
{
document.getElementById("tabID_tabpID_ctlxswxInfo1_sgfasy").innerHTML = curr.toString();
}
return true;
}
}
</script>
<asp:TextBox ID="txtsgfa" runat="server" onkeyup="checkLength(this,2);" TextMode="MultiLine" MaxLength="312" Width="100%" Height="100%"></asp:TextBox>