<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Registration.aspx.cs" Inherits="_Default" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<style type="text/css">
.style1
{
height: 12px;
}
.style2
{
width: 180px;
}
.style3
{
height: 12px;
width: 180px;
}
</style>
<script type="text/javascript">
function LengthCheck(txt)
{
var at = txt.value.length;
if (at != 10)
{
alert("Enter The last 10 characters");
// txtValue.focus();
}
}
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:TextBox ID="txtValue" runat="server" onblur="LengthCheck(this)"/>
<asp:TextBox ID="txtValue1" runat="server"/>
</asp:Content>
The above code check the txtValue length successfully... but after showing the alert box ...The cursor goes to the next textbox(txtValue1)...
so i used txtValue.focus() ....this time it will throw the JavaScript Exception....then i used Document ElementById(),Document_form()....it will give same error..
Give me solution ....
Thanks