Bonjour,

j'ai une petite page web sur laquelle il y a deux zones de textes et un bouton,
je voudrais, qu'une fois la première zone de texte remplie avec 11 caracteres, le focus passe automatiquement sur la deuxième zone de texte

J'ai mis le ".focus" dans l'évenement textchanged du premier textbox mais ça ne fonctionne pas. Je ne sais pas pourquoi mais ça fonctionne quand je fais un debug pas à pas.
J'ai l'impression que c'est un problème "daller retour server", ou alors si quelqu'un a une autre méthode pour faire ça, je suis preneur.

Voici mon code :
Code HTML : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
</script>
   <script language="vb" runat="server" >
       Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
           If (Kanban.Text.Contains(Tapis.Text.Substring(0, 10))) Then
               Button1.BackColor = Drawing.Color.Green
               Button1.Text = "OK"
           Else
               Button1.BackColor = Drawing.Color.Red
               Button1.Text = "NOK"
           End If
           Kanban.Text = ""
           Tapis.Text = ""
           Tapis.Focus()
       End Sub
 
       Private Sub Tapis_TextChanged(sender As Object, e As EventArgs) Handles Tapis.TextChanged
           If Tapis.Text.Length > 10 Then
               Kanban.Focus()
           End If
       End Sub
</script>
</head>
<body>
    <form id="form1" runat="server" >
    <div>
       <table class="auto-style1" >
             <tr>
                <td>
                    <asp:TextBox ID="Tapis" runat="server"  Font-Size="XX-Large" Height="83px" Width="245px" AutoPostBack="true"  ></asp:TextBox> 
                </td>
            </tr>
            <tr>
                <td>
                    <asp:TextBox ID="Kanban" runat="server"  Font-Size="XX-Large" Height="90px" Width="248px" AutoPostBack ="true"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Button ID="Button1" runat="server" Height="186px" Text="Button" Width="257px" Font-Size="XX-Large" />
                </td>
            </tr>
        </table>
        </div>
    </form>
</body>
</html>

Merci