Visualizzazione dei risultati da 1 a 3 su 3

Discussione: spostarsi nella form

  1. #1
    Utente di HTML.it
    Registrato dal
    Jan 2003
    Messaggi
    1,093

    spostarsi nella form

    Ciao a tutti,

    ho un problema...

    E' possibile creare una funzione generica che dia all' invio le stesse caratteristiche del TAB per spostarmi di campo in campo?

    pero quando incontra un botton o submit o cancel, agire con le funzioni classiche del click sul bottone quindi inviarem cancellare ecc..?

    Grazie

  2. #2
    Dovrebbe andare bene così:
    codice:
    <SCRIPT > 
    //SCRIPT CHE ALLA PRESSIONE DI INVIO MI PASSA AL CAMPO SUCCESSIVO
    nextfield = "datadocumento"; 
    netscape  = ""; 
    ver       = navigator.appVersion; 
    len       = ver.length; 
     
    for( iln = 0; iln < len; iln++ ) { 
    	if( ver.charAt( iln ) == "(" ) { 
    		break; 
    	} 
    } 
    netscape = ( ver.charAt( iln+1 ).toUpperCase() != "C" ); 
     
    	// handle the keypress 
    function keyDown( DnEvents ) { 
     
    		// determine whether Netscape or Internet Explorer 
    	k = ( netscape ) ? DnEvents.which : window.event.keyCode; 
     
    		// enter key pressed 
    	if ( k == 13 ) { 
    		if ( nextfield == 'done' ) { 
    				// submit, we finished all fields 
    			return true; 
    		} else { 
    				// we are not done yet, send focus to next box 
    			eval( 'document.data.' + nextfield + '.focus()' ); 
    			return false; 
    		} 
    	} 
    } 
     
    	// work together to analyze keystrokes 
    document.onkeydown = keyDown; 
     
    if ( netscape ) { 
    	document.captureEvents( Event.KEYDOWN|Event.KEYUP ); 
    } 
    </SCRIPT>
    da usare così
    codice:
    <input name="qta3" type="text" id="qta32" size="5"   onFocus="nextfield='prezzo3'" >
    <input name="prezzo3" type="text" id="prezzo3" size="20"   onFocus="nextfield='rif3'" >

  3. #3
    Utente di HTML.it
    Registrato dal
    Jan 2003
    Messaggi
    1,093
    grazie mille ..stavo per riprendere il problema...

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.