The following code can achieve this switching effect.
First, let's look at the interface:
Interface code:Copy codeThe Code is as follows: <body>
<Form id = "form1" runat = "server">
<Div align = "center">
<Fieldset style = "width: 400px; height: 200px;">
<Table cellpadding = "3" cellspacing = "3" border = "0">
<Tr>
<Td>
<Asp: Label ID = "lblName" Text = "name:" runat = "server"> </asp: Label>
</Td>
<Td>
<Asp: TextBox ID = "txtName" Width = "200px" runat = "server"> </asp: TextBox>
</Td>
</Tr>
<Tr>
<Td>
<Asp: Label ID = "lblAddress" Text = "Address:" runat = "server"> </asp: Label>
</Td>
<Td>
<Asp: TextBox ID = "txtAddress" Width = "200px" runat = "server"> </asp: TextBox>
</Td>
</Tr>
<Tr>
<Td>
<Asp: Label ID = "lblContact" Text = "contact number:" runat = "server"> </asp: Label>
</Td>
<Td>
<Asp: TextBox ID = "txtContact" Width = "200px" runat = "server"> </asp: TextBox>
</Td>
</Tr>
<Tr>
<Td>
<Asp: Label ID = "lblEmail" Text = "Email:" runat = "server"> </asp: Label>
</Td>
<Td>
<Asp: TextBox ID = "txtEmail" Width = "200px" runat = "server"> </asp: TextBox>
</Td>
</Tr>
<Tr>
<Td>
</Td>
<Td>
<Asp: Button ID = "btnSubmit" Text = "Submit" runat = "server"/>
<Asp: Button ID = "btnReset" Text = "reset" runat = "server"/>
</Td>
</Tr>
</Table>
</Fieldset>
</Div>
</Form>
</Body>
Script code:Copy codeThe Code is as follows: <Title> Recipe2 </title>
<Script src = "Scripts/jquery-1.4.1-vsdoc.js" type = "text/javascript"> </script>
<Script type = "text/javascript">
$ (Document). ready (function (){
$ ("Input: text: first"). focus (); // the TextBox is converted to the <input type = "text"/>
$ ("Input: text"). bind ("keydown", function (e ){
If (e. which = 13) {// obtain the Enter key value
E. preventDefault (); // prevents forms from being submitted by pressing Enter.
Var nextIndex = $ ("input: text"). index (this) + 1;
$ ("Input: text") [nextIndex]. focus ();
}
});
$ ("# <% = BtnReset. ClientID %>"). click (function (){
$ ("Form") [0]. reset ();
});
});
</Script>
</Head>