Define Script in design side
<script type="text/javascript">
function textCounter(field, countfield, maxlimit,msg,word)
{
if (field.value.length > maxlimit)
field.value = field.value.substring(0, maxlimit);
else
{
countfield.value =maxlimit - field.value.length;
word.value=field.value.length;
if(word.value > 160 && word.value <= 321)
msg.value="2";
else if(word.value > 321 && word.value <= 482)
msg.value="3";
else if(word.value > 482 && word.value <= 643)
msg.value="4";
else if(word.value > 643 && word.value <= 800)
msg.value="5";
else
msg.value="1";
}
}
</script>
<asp:TextBox ID="TxtMessage" runat="server" Height="92px"
onkeydown="textCounter(this, this.form.countLen, 800,this.form.msgcount,this.form.wcount);"
onkeyup="textCounter(this, this.form.countLen, 800,this.form.msgcount,this.form.wcount);" TextMode="MultiLine"></asp:TextBox>
<input maxlength="3" name="countLen" readonly="readonly" size="3"
style="width: 26px; height: 16px;" type="text" value="800"
style="border:none; border-color:White; background-color:White;" />Characters Left<br />
<font color="red">
Total
<input name="wcount" value="0" type="text" readonly="readonly"
style="border:medium none White; background-color:White; width: 24px; height: 15px; color:Red;" />Word(s)
and <input name="msgcount" value="0" type="text" readonly="readonly"
style="border:medium none White; background-color:White; width: 14px; height: 15px; color:Red;" />Message(s)
0 comments:
Post a Comment