<script>
var t = "";
function maxLimit() {
if ($.trim($("#txtContent").val()).length > 140) {
$("#txtleft").text("已经超出");
$("#LabelContent").text(($.trim($("#txtContent").val()).length) - 140);
}
else {
$("#txtleft").text("还能输入");
$("#LabelContent").text(140 - ($.trim($("#txtContent").val()).length));
}
}
function setTimeouts() {
maxLimit();
t = setTimeout("setTimeouts()", 1 * 10);
};
function clearTimeouts() {
clearTimeout(t);
};
$(document).ready(function() {
//$("#txtContent").keyup(maxLimit);
//$("#txtContent").keydown(maxLimit);
$("#txtContent").bind("blur", clearTimeouts);
$("#txtContent").bind("focus", setTimeouts)
});
</script>
在body编辑中添加
代码如下:
<div> <asp:TextBox ID="txtContent" runat="server" Width="500px" TextMode="MultiLine" MaxLength="140"
Height="100px"></asp:TextBox></div>
<div><span id="txtleft">还能输入</span><asp:Label ID="LabelContent" runat="server" ForeColor="Red"
Text="140"></asp:Label><span>个字符</span></div>
Copyright © 2019- huatuo9.cn 版权所有 赣ICP备2023008801号-1
违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务