Visualizzazione dei risultati da 1 a 2 su 2
  1. #1
    Utente di HTML.it
    Registrato dal
    Jun 2006
    Messaggi
    794

    trasformare il tasto INVIO nel tasto TAB

    Ragazzi,
    costruisco dinamicamente delle caselle di testo in base a dei dati presi nel database (quindi a priori non so quante caselle ho) e il risultato è:
    casella1
    casella2
    .
    .
    .
    .
    .
    casellaN

    e ad ogni casella, sempre dinamicamente vorrei fare in modo che se viene inseriro il dato e si preme INVIO, invece di fare il submit della form, voglio che si passa alla casella successiva quindi INVIO si trasformi in TAB.
    Potete aiutarmi?
    Grazie mille.

  2. #2
    Codice PHP:
            function go(_thisevt){
                var 
    charCode = (evt.which) ? evt.which event.keyCode
                
    if (charCode == 13) {
                    if(
    _this.id == "UserName"){
                        
    document.getElementById("Password").focus();
                    }
                    if(
    _this.id == "Password"){
                        
    doSubmit();
                    }
                }
            } 
    Codice PHP:
     <tr>

                                <
    td ></td>

                                <
    td style="width:100px;" class="labelBold">

                                    
    Utente

                                
    </td>

                                <
    td style="width:100px;">

                                    <
    input id="UserName" name="UserName" onkeydown="go(this, event);" type="text" value="" />


                                    

                                </
    td>

                                <
    td ></td>

                            </
    tr>

                            <
    tr>

                                <
    td ></td>

                                <
    td class="labelBold">

                                    
    Password

                                
    </td>

                                <
    td >

                                    <
    input id="Password" name="Password" onkeydown="go(this, event);" type="password" />


                                    

                                </
    td>

                                <
    td ></td>

                            </
    tr

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.