Click here to Skip to main content
15,891,473 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hai,

In Webpage when user press tab key it should focus only save button.


any ideas guys,
Posted
Comments
sharmarun 15-May-12 7:46am    
controlname.focus();
Technoses 29-May-12 6:50am    
if your problem got solved! Please mark it as solution

You can override the Controls' KeyDown[^] event and manually move the focus over to the Control that should receive focus.
 
Share this answer
 
you can use

HTML
<body onkeydown="kd();"></body>



JavaScript
function kd()
{
    if(event.keyCode==9)
    {
        document.getElementById("btn").focus();
    }
}
 
Share this answer
 
Comments
Sandeep Mewara 15-May-12 10:28am    
My 5!
Technoses 15-May-12 11:59am    
if problem solved. mark it as solution
Sandeep Mewara 15-May-12 12:21pm    
I cannot. :)

Only the person who asks question can.
Set Button Property

C#
<asp:button id="button1" tabindex="1" runat="server"/>
 
Share this answer
 
v3
Comments
Anuja Pawar Indore 15-May-12 10:40am    
Added pre tag
try like this,

XML
<body>
    <form id="form1" runat="server">
     <script type="text/javascript">
         var txt = document.getElementById("nameTextBox1");
         if (txt != null)
          {
             txt.focus();
          }
        </script>
    <div>

<table>
   <tr>
      <td class="style1">
        what is u r name :&nbsp;  <asp:TextBox ID="nameTextBox1" runat="server"></asp:TextBox>
      </td>
   </tr>
   <tr>
       <td class="style1">
         enter u r age&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;   :&nbsp;
         <asp:TextBox ID="nextTextBox2" runat="server"
            ontextchanged="nextTextBox2_TextChanged" > </asp:TextBox>
      </td>
   </tr>
    <tr>

    </tr>
 </table>

    &nbsp;&nbsp;

    </div>

    </br>
    <div>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          <asp:Button ID="Button1" runat="server" Text="on click" >
               </asp:Button>
        </div>
    </form>
</body>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900