<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<script type="text/javascript" language="javascript">
function CountTxtLeft(StrTxt, txtCount, totaltxt) {
if (StrTxt.value.length > totaltxt)
{
StrTxt.value = StrTxt.value.substring(0, totaltxt);
}
else
{
txtCount.value ='Total characters left :' + (totaltxt - StrTxt.value.length);
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<textarea id="message" runat="server" cols="1" onkeydown="CountTxtLeft(this.form.message,this.form.charleft,140);"
onkeyup="CountTxtLeft(this.form.message,this.form.charleft,140);" style="border: thin solid gray;
width: 407px; height: 114px">
</textarea>
</div>
<input id="charleft" type="text" readonly="true" style="border: none 0px transparent;
width: 186px;" />
</form>
</body>
</html>
Comments
Post a Comment