<script type="text/javascript" src="jquery.js"></script>
<script>
//文本框字数判断函数头
function textvali(){
var countlenget=140;
var eachlenget=70;
if ($("#countent").val().length>countlenget)
{
$("#countent").val($("#countent").val().substring(0,140));
}
$("#Countlenget").html(countlenget);
$("#Already").html($("#countent").val().length);
$("#Residual").html(countlenget-$("#countent").val().length);
$("#Eachlenget").html(eachlenget);
$("#Msglenget").html(Math.ceil($("#countent").val().length/eachlenget));
}
//文本框字数判断函数尾
$(document).ready(
function(){
textvali()
}
);
</script>
<textarea name="countent" cols="40" rows="5" οnkeyup="textvali()" id="countent" ></textarea><br />
一共可以输入<span id="Countlenget">140</span>字,已输入<span id="Already">0</span>字 还能输入<span id="Residual">140</span>字 每<span id="Eachlenget"></span>字为一条短信 当前为<span id="Msglenget"></span>条短信
<script>
//文本框字数判断函数头
function textvali(){
var countlenget=140;
var eachlenget=70;
if ($("#countent").val().length>countlenget)
{
$("#countent").val($("#countent").val().substring(0,140));
}
$("#Countlenget").html(countlenget);
$("#Already").html($("#countent").val().length);
$("#Residual").html(countlenget-$("#countent").val().length);
$("#Eachlenget").html(eachlenget);
$("#Msglenget").html(Math.ceil($("#countent").val().length/eachlenget));
}
//文本框字数判断函数尾
$(document).ready(
function(){
textvali()
}
);
</script>
<textarea name="countent" cols="40" rows="5" οnkeyup="textvali()" id="countent" ></textarea><br />
一共可以输入<span id="Countlenget">140</span>字,已输入<span id="Already">0</span>字 还能输入<span id="Residual">140</span>字 每<span id="Eachlenget"></span>字为一条短信 当前为<span id="Msglenget"></span>条短信