Please visit our sponsor
UNKNOWN //************************************** //HTML for :Text Box Jump //************************************** example: <input type="text" name="name" value="" size="4" maxlength="4" onkeyup="NextBox('name',4);"> //************************************** // Name: Text Box Jump // Description:This script will allow you to jump from one text box to the next when a desired length is reached. // By: Michael2319 // // // Inputs:ObjName --&gt; Name of Text Box ObjNum --&gt; Max characters to be typed before jumping // // Returns:NONE // //Assumes:to call this function place the following code in your text box instantiation --&gt; onkeyup="NextBox('text_box_name',value to jump at(int));" // //Side Effects:NONE //This code is copyrighted and has limited warranties. //Please see http://www.Planet-Source-Code.com/xq/ASP/txtCodeId.1784/lngWId.2/qx/vb/scripts/ShowCode.htm //for details. //************************************** <script language="JavaScript"> <!-- Begin // Author: Michael Ray Brown // Email: mrb23@bellsouth.net // // This script will allow you to jump from one text box to the next // when a desired length is reached. There are two input variables // ObjName --> Name of Text Box // ObjNum --> Max characters to be typed before jumping // // to call this function place the following code to your text box // instantiaion --> onkeyup="NextBox('text_box_name',value to jump at(int));" function NextBox(ObjName,ObjNum) { // 1st example if (ObjName == "textbox_name here") { // move to next text field if (ObjNum == 2) { if (document.form_name.textbox_name1.value.length == "set value you want to jump at(example='3')) { document.form_name.textbox_name2.focus() } else { document.form_name.textbox_name1.focus() } } } // 2nd example else if (ObjName == "textbox_name here") { // move to next text field if (ObjNum == 2) { if (document.form_name.textbox_name1.value.length == 2) { document.form_name.textbox_name2.focus() } else { document.form_name.textbox_name1.focus() } } } // 3rd example featuring 4 text boxes // a good example would be for credit card # input else if (ObjName == "textbox_name here") { // move to next text field if (ObjNum == 2) { if (document.form_name.textbox_name1.value.length == 4) { document.form_name.textbox_name2.focus() } else { document.form_name.textbox_name1.focus() } } else if (ObjNum == 3) { if (document.form_name.textbox_name2.value.length == 4) { document.form_name.textbox_name3.focus() } else { document.form_name.textbox_name2.focus() } } else if (ObjNum == 4) { if (document.form_name.textbox_name3.value.length == 4) { document.form_name.textbox_name4.focus() } else { document.form_name.textbox_name3.focus() } } } } // End --> </script>