form advance

G

Guest

I would like to create a form that has a space for a phone number. I want to
use three boxes (area code, prefix and number) my question is….

How can I get the curser to automatically move to the next box when entering
the numbers? I would like this to be done without hitting the tab button.

I have been on many sites that it works like this

Any ideas?

Thank you in advance
 
P

Paul M

Hi
You copy and paste the code into an empty page (remove all html) and save
the page as a javascript page say tab.js then add this into the head
of your form page

<SCRIPT LANGUAGE="JavaScript" SRC="tab.js"></SCRIPT>

It doesn't give you the example form code but here is the code for the form
You can add this to your own form just don't use the form tags if you do.
Remember to save the page before previewing or the javascipt won't work

Paul M

<FORM>
Enter a phone number. The field will auto-tab when you enter 3 characters.
<table>
<tr>
<td>Phone No.:</td>
<td>
<input type=text name="Phone_1" size=3 maxlength=3
nKeyDown="TabNext(this,'down',3)"
onKeyUp="TabNext(this,'up',3,this.form.Phone_2)">
-
<input type=text name="Phone_2" size=3 maxlength=3
onKeyDown="TabNext(this,'down',3)"
onKeyUp="TabNext(this,'up',3,this.form.Phone_3)">
-
<input type=text name="Phone_3" size=4 maxlength=4>
</td>
</tr>
</table>
</FORM>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top