复制代码 代码如下:
<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>
复制代码 代码如下:
<div> <asp:TextBox runat="server" TextMode="MultiLine" MaxLength="140"
Height="100px"></asp:TextBox></div>
<div><span>还能输入</span><asp:Label runat="server" ForeColor="Red"
Text="140"></asp:Label><span>个字符</span></div>
新闻热点
疑难解答
图片精选