<script type="text/javascript" language="javascript">
function limitCharsLength(Object, MaxLen) {
if (Object.value.length > MaxLen - 1) {
Object.value = Object.value.substring(0, MaxLen);
// document.getElementById(divmsg).style.visibility = "visible";
document.getElementById('divmsg').style.display = "block";
}
else {
document.getElementById('divmsg').style.display = "none";
}
}
</script>
---------------------------------------------
<asp:TextBox ID="txtdesc" TextMode="MultiLine" Rows="10" MaxLength="100" Width="250px"
onkeypress="javascript: return limitCharsLength(this,100);"
onblur="javascript:return limitCharsLength(this, 100)"
onchange="javascript : return limitCharsLength(this, 100)" runat="server">
</asp:TextBox>
<div id="divmsg" runat="server" style="display:none; background-color:#e65810; font-size:smaller; color:White; font-family:Verdana;width:250px;" >
Maximum (100) characters allowed!</div>
-------------------------------------------------------
0 comments:
Post a Comment