Recent Posts
· Using formulas in Microsoft Excel CSV files
· Getting an Epson LX-810 printer to work on Windows...
· Javascript code to jump cursor to next box in an H...
· Old versions of software
· Internet Explorer 7 keeps redrawing screen on Wind...
· Blogger: stack overflow at line 54 part 2
· Rules automatically created for the program: Syman...
· Rules automatically created for the program: Syman...
· Rules automatically created for the program: Syman...
· But does it get you off the junk fax lists?

Archives
April 2005
May 2005
June 2005
July 2005
August 2005
November 2005
December 2005
January 2006
February 2006
March 2006
May 2006
June 2006
July 2006
August 2006
October 2006
March 2007
May 2007
June 2007
September 2007
November 2007
January 2008
June 2008
August 2008

Links
· Startup Applications List
· Welcome to the Hex Hub (Named Hexadecimal Color Codes for HTML)



More blogs on this site:



Powered by Blogger
 

Computer Blog - thebroadroom.net

Disclaimer: all of the following is purely from personal experience. TheBroadroom.Net urges you to use your own instincts, common sense, and willingness to take risks when applying any of the information below.

Geeks rule.
Profile · Current Blog



Google Custom Search


Javascript code to jump cursor to next box in an HTML form
posted by Colleen Shirazi, Saturday, June 14, 2008 at 8:17 PM (Pacific)

Looking for a quick way to advance the user's cursor to the next input element in your HTML form? Say, after they have typed three characters, as in a phone number?

function check(theElement,nextElement) {

if(theElement.value.length >= theElement.maxLength) {
document.authenticate.elements[nextElement].focus();
}
else {
document.authenticate.theElement.focus();
}
return true;
}

...

<form method="POST" action="youraction" name="authenticate">

<input type="text" size="3" maxlength="3" name="area_code" value="" onKeyUp="check(this,'first_three')" />

<input type="text" size="3" maxlength="3" name="first_three" value="" onKeyUp="check(this,'last_four')" />

<input type="text" size="4" maxlength="4" name="last_four" value="" onKeyUp="check(this,'function')" />

<input name="function" value="Sign In" type="submit" />

</form>

Labels: , ,


0 Comment(s)