April 27, 2011

Show live remaining count

function CountLeft()
{
var SMSContent = document.getElementById('txtSMSContent').value;
var max = 150;

if (SMSContent.length > max)
document.getElementById('txtSMSContent').value = document.getElementById('txtSMSContent').value.substring(0, max);
else
document.getElementById('txtLength').value = max - document.getElementById('txtSMSContent').value.length;
}


onKeyUp="CountLeft();" MaxLength="150" TextMode="MultiLine">

No comments:

Post a Comment