1 Reply Latest reply on Sep 26, 2008 1:04 PM by Vernontnh

    Action Script code for focus

    Vernontnh
      Can someone please help. I just need the script necessary to force the curser from one text field to another when pressing the tab key. Here's some script that I found in the template I purchased. But this seems to be used to control color, not the progression of text field selection by pressing the tab button. By the way, this is the only place in the action script where the word, "Focus" appears, but the tab works until you get to the "State" field at which point it skips to a dropdown menu.

      Can someone set me straight? Here's the script:

      //Changes the background colors on focus as well as removing the text currently in the textbox.
      nameTxt.onSetFocus = function() {
      nameTxt.text="";
      nameTxt.backgroundColor = tbgColorOn;
      emailTxt.backgroundColor = addressTxt.backgroundColor=cityTxt.backgroundColor=stateTxt.backgroundColor=zipTxt.backgr oundColor=ageTxt.backgroundColor=genderTxt.backgroundColor=descTxt.backgroundColor=tbgColo rOff;
      };
      emailTxt.onSetFocus = function() {
      emailTxt.text="";
      emailTxt.backgroundColor = tbgColorOn;
      nameTxt.backgroundColor = addressTxt.backgroundColor=cityTxt.backgroundColor=stateTxt.backgroundColor=zipTxt.backgr oundColor=ageTxt.backgroundColor=genderTxt.backgroundColor=descTxt.backgroundColor=tbgColo rOff;
      };
      addressTxt.onSetFocus = function() {
      addressTxt.text="";
      addressTxt.backgroundColor = tbgColorOn;
      nameTxt.backgroundColor = emailTxt.backgroundColor=cityTxt.backgroundColor=stateTxt.backgroundColor=zipTxt.backgrou ndColor=ageTxt.backgroundColor=genderTxt.backgroundColor=descTxt.backgroundColor=tbgColorO ff;
      };
      cityTxt.onSetFocus = function() {
      cityTxt.text="";
      cityTxt.backgroundColor = tbgColorOn;
      nameTxt.backgroundColor = emailTxt.backgroundColor=addressTxt.backgroundColor=stateTxt.backgroundColor=zipTxt.backg roundColor=ageTxt.backgroundColor=genderTxt.backgroundColor=descTxt.backgroundColor=tbgCol orOff;
      };
      stateTxt.onSetFocus = zipTxt.onSetFocus=function() {
      stateTxt.text="";
      stateTxt.backgroundColor = tbgColorOn;
      nameTxt.backgroundColor = emailTxt.backgroundColor=addressTxt.backgroundColor=cityTxt.backgroundColor=zipTxt.backgr oundColor=ageTxt.backgroundColor=genderTxt.backgroundColor=descTxt.backgroundColor=tbgColo rOff;
      };
      zipTxt.onSetFocus = ageTxt.onSetFocus = function() {
      zipTxt.text="";
      zipTxt.backgroundColor = tbgColorOn;
      nameTxt.backgroundColor = emailTxt.backgroundColor=addressTxt.backgroundColor=cityTxt.backgroundColor=stateTxt.back groundColor=ageTxt.backgroundColor=genderTxt.backgroundColor=descTxt.backgroundColor=tbgCo lorOff;
      };
      ageTxt.onSetFocus = function() {
      ageTxt.text="";
      ageTxt.backgroundColor = tbgColorOn;
      nameTxt.backgroundColor = emailTxt.backgroundColor=addressTxt.backgroundColor=cityTxt.backgroundColor=stateTxt.back groundColor=zipTxt.backgroundColor=genderTxt.backgroundColor=descTxt.backgroundColor=tbgCo lorOff;
      };
      genderTxt.onSetFocus = function() {
      genderTxt.text="";
      genderTxt.backgroundColor = tbgColorOn;
      nameTxt.backgroundColor = emailTxt.backgroundColor=cityTxt.backgroundColor=addressTxt.backgroundColor=zipTxt.backgr oundColor=ageTxt.backgroundColor=descTxt.backgroundColor=tbgColorOff;

      };
      descTxt.onSetFocus = function() {
      descTxt.text="";
      descTxt.backgroundColor = tbgColorOn;
      nameTxt.backgroundColor = emailTxt.backgroundColor=cityTxt.backgroundColor=stateTxt.backgroundColor=addressTxt.back groundColor=zipTxt.backgroundColor=ageTxt.backgroundColor=genderTxt.backgroundColor=tbgCol orOff;
      };