For everyone's benefit, this is the script that was sent to me that works
for this situation:

<script language="JavaScript">
var isNN = (navigator.appName.indexOf("Netscape")!=-1);
function autoTab(input,len, e) {
var keyCode = (isNN) ? e.which : e.keyCode; 
var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
if(input.value.length >= len && !containsElement(filter,keyCode)) {
input.value = input.value.slice(0, len);
input.form[(getIndex(input)+1) % input.form.length].focus();
}
function containsElement(arr, ele) {
var found = false, index = 0;
while(!found && index < arr.length)
if(arr[index] == ele)
found = true;
else
index++;
return found;
}
function getIndex(input) {
var index = -1, i = 0, found = false;
while (i < input.form.length && index == -1)
if (input.form[i] == input)index = i;
else i++;
return index;
}
return true;
}
</script>
 
Then your text controls will be something like this:
 
<input type="Text" name="MM" maxlength="2" size="2" onkeyup="return
autoTab(this, 2, event);")>
<input type="Text" name="DD" maxlength="2" size="2" onkeyup="return
autoTab(this, 2, event);")>
<input type="Text" name="YY" maxlength="2" size="2" onkeyup="return
autoTab(this, 2, event);")>

-----Original Message-----
From: Bryan LaPlante [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 01, 2001 9:59 AM
To: [EMAIL PROTECTED]
Subject: Re: [KCFusion] JavaScript question


essentially the script looks like this.

<script>
function goTab(next,max){
    len = event.srcElement.value.length
    if (len == max){
        eval("document.formname." + next + ".focus()");
    }
}
</script>
</head>

<body>
<form name="formname">
<input type="text" name="first" onkeypress="goTab('second',3)" size="3">
<input type="text" name="second" size="2">
</form>

----- Original Message -----
From: "Sheeran, Jean" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, May 01, 2001 9:46 AM
Subject: [KCFusion] JavaScript question


> I have an area of my form that is set up for a date entry as follows:
>
> __/__/__
> mm dd yy
>
> I would like to use JavaScript (or something better) to detect when 2
> characters have been entered into the 'mm' field, and then to set focus to
> the 'dd' field.  (then the same for the dd-> yy field)  Essentially to the
> end user, it is as simple as just typing a string of 6 characters instead
of
> having to 'Tab' through or click the next field.  How does one achieve
this?
>
>
> ______________________________________________________________________
> The KCFusion.org list and website is hosted by Humankind Systems, Inc.
> List Archives........ http://www.mail-archive.com/cf-list@kcfusion.org
> Questions, Comments or Glowing Praise.. mailto:[EMAIL PROTECTED]
> To Subscribe.................... mailto:[EMAIL PROTECTED]
> To Unsubscribe................ mailto:[EMAIL PROTECTED]
>
>

 
 
______________________________________________________________________
The KCFusion.org list and website is hosted by Humankind Systems, Inc.
List Archives........ http://www.mail-archive.com/cf-list@kcfusion.org
Questions, Comments or Glowing Praise.. mailto:[EMAIL PROTECTED]
To Subscribe.................... mailto:[EMAIL PROTECTED]
To Unsubscribe................ mailto:[EMAIL PROTECTED]
 
 
 
______________________________________________________________________
The KCFusion.org list and website is hosted by Humankind Systems, Inc.
List Archives........ http://www.mail-archive.com/cf-list@kcfusion.org
Questions, Comments or Glowing Praise.. mailto:[EMAIL PROTECTED]
To Subscribe.................... mailto:[EMAIL PROTECTED]
To Unsubscribe................ mailto:[EMAIL PROTECTED]
 

Reply via email to