Ho uno script che alla pressione di enter/invio mi passa al campo successivo ma quando si arriva alla textarea non mi fa andare a capo perchè ovviamente lo script mi disabilita l'invio...come faccio ad andare a capo nella textarea?
La pagina la potete provare QUI'
codice:<onload="document.data.Spett.focus()" > <SCRIPT language=javascript> 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> <form name=data method="post" action="CartaIntestataAdd-Process.asp"> <input name="Spett" type="text" id="Spett3" size="30" onFocus="nextfield='Data';" > <input name="Data" id="Data3" onFocus="nextfield='Oggetto';" size ="30"> <input name="Oggetto" id="Oggetto4" onFocus="nextfield='Corpo'; " size ="120"> <textarea name=Corpo cols=120 rows=16 id=textarea4 ></textarea> <input name="Saluti" id="Saluti4" size ="23"> <input name="Aggiungi" type="submit" id="Aggiungi" style ="CURSOR: hand" title="Salva l'inserimento del nuovo ordine" value="Aggiungi" > </FORM>

Rispondi quotando