Results 1 to 1 of 1

Thread: Java script code for Auto tab (form field)

  1. #1

    Java script code for Auto tab (form field)

    This script "auto tabs" a form field (and jumps to another field) once the length of the field's value has exceeded a certain length. It works in conjunction with the "maxlength" attribute of HTML, triggered whenever the user's input reaches the maxlength's value.
    Make certain types of form fields more intuitive and convenient to fill out with this script.



    HTML Code:
    <script>
    
    function autotab(original,destination){
    if (original.getAttribute&&original.value.length==original.getAttribute("maxlength"))
    destination.focus()
    }
    
    </script>
    
    <b>Enter your 10-digit phone number:</b>
    <form name="sampleform">
    <input type="text" name="first" size=4 onKeyup="autotab(this, document.sampleform.second)" maxlength=3> <input type="text" name="second" size=4 onKeyup="autotab(this, document.sampleform.third)" maxlength=3> <input type="text" name="third" size=5 maxlength=4>
    
    </form>
    Demo is available in the attachment...
    Attached Files Attached Files

Similar Threads

  1. Replies: 3
    Last Post: 11-06-2013, 04:14 PM
  2. Replies: 0
    Last Post: 10-29-2013, 10:04 PM
  3. How to enable Auto start (Auto boot) a VM on Server Boot
    By Annie Arnold in forum Server Virtualization
    Replies: 0
    Last Post: 11-18-2012, 03:17 PM
  4. Replies: 0
    Last Post: 09-07-2011, 05:19 PM
  5. Creating a simple feedback form using PHP
    By Madiha Fatima in forum PHP
    Replies: 0
    Last Post: 10-05-2010, 12:20 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •