curser moving automatically between fields on a form

liunx

Guest
I am creating a form and would like the cursor to automatically jump to the next field - especially when entering a phone number that I've set up as a 3+3+4 type of thing. How would I accomplish this?<br />
<br />
Thanks in advance! :)<!--content-->You could use the maxlength attribute on <input> from where your JavaScript could get the size.<br />
<!-- m --><a class="postlink" href="http://www.w3.org/TR/html4/interact/forms.html#adef-maxlength">http://www.w3.org/TR/html4/interact/for ... -maxlength</a><!-- m --><br />
<br />
eg <br />
<input size="3" maxlength="3"><br />
<input size="3" maxlength="3"><br />
<input size="4" maxlength="4"><br />
<br />
It also prevents people from entering too many numbers in 1 field even if JS is not available (but they have to press tab manually to jump to the next input box of cource =)<!--content-->Originally posted by Dave Clark <br />
Note to laria: If you care about those who use NS4, you will have to do as I suggested above. In other words, the maxlength attribute, mentioned, does not work in that browser/version (maybe others, too).<br />
<br />
Dave <br />
<br />
Just out of interest, wouldn't a javascript be able to get the value of maxlenght even if the browser doesn't implement the correct behaviour in the HTML? :confused:<!--content-->Originally posted by Dave Clark <br />
NS4 will only allow new properties that are created from within JavaScript itself.<br />
<br />
<br />
:(<br />
<br />
It's stuff like that makes you glad NS 4 is on the way to die out :)<!--content-->well yeah.. I wasn't thinking that I had to worry about dated versions of browsers. I thought about it afterwards too and most people are used to tabbing between fields and to throw something different at the general population is usually devastating to them anyway ;) People like 'same ole same ole'. <br />
Thank you all for taking the time to respond. I appreciate it :)<!--content-->
 
Back
Top