Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Set focus to textbox
Message
General information
Forum:
Visual FoxPro
Category:
Internet applications
Miscellaneous
Thread ID:
00689308
Message ID:
00689403
Views:
23
>I have several ASPs that have forms that contain phone numbers in the 3 textbox format.
>ie:
>txtAreaCode txtExchange txtFourDigits
>
>My users have to tab out of each textbox to keyboard an entire phone number. Do you have any suggestions on how to have the focus set to the next textbox when a user completes the entry in the preceeding textbox?

Here's something that might get you started... there may be a better way, I was just knocking around with this.
<SCRIPT LANGUAGE="JavaScript">

function checklength(input,nlen,cgoto) {
if (input.value.length == nlen) {
 eval('thisform.'+cgoto+'.focus()');
}
}

function resetval(input) {
input.value = '';
input.focus();
}

</SCRIPT>
<html>

<body>

<form name=thisform>
<input type = text size=3 name=three maxlength=3 onfocus=resetval(this); onkeydown=checklength(this,3,'four');>
<input type=text size=3 name=four>
</form>
</body>
</html>
Wayne Myers, MCSD
Senior Consultant
Forte' Incorporated
"The only things you can take to heaven are those which you give away" Author Unknown
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform