Character Counter for text boox javascript in .cs file

<tr>
<td align="left" class="heading_text1" style="width: 1057px">
<asp:TextBox ID="txtBiography" runat="server" Height="218px" TextMode="MultiLine"
Width="518px" MaxLength="3000"></asp:TextBox>
</td>
</tr>
<tr>
<td align="left" class="heading_text1" style="width: 1057px">
<asp:TextBox ID="txtCount" runat="server"
BorderStyle="None" ReadOnly="True">0</asp:TextBox>

</td>
</tr>


protected void Page_Load(object sender, EventArgs e)

{
  txtCount.Text = txtBiography.MaxLength.ToString();
        txtBiography.Attributes.Add("onKeyDown",
           "if(document.getElementById ('" + txtBiography.ClientID + "').value.length<3001){document.getElementById ('" + txtCount.ClientID + "').value = 3000 - document.getElementById('" + txtBiography.ClientID + "').value.length; } else if(event.keyCode==08){ return true;} else {alert('Please limit your entry to 3000 characters or less.'); return false;}");
        txtBiography.Attributes.Add("onKeyUp",
           "if(document.getElementById ('" + txtBiography.ClientID + "').value.length<3001){document.getElementById ('" + txtCount.ClientID + "').value = 3000 - document.getElementById('" + txtBiography.ClientID + "').value.length; } else if(event.keyCode==08){ return true;} else {alert('Please limit your entry to 3000 characters or less.'); return false;}");


}