<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2719.2200" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY style="COLOR: #000000; FONT-FAMILY: Arial" bgColor=#ffffff>
<DIV><SPAN class=586291320-24032003><FONT size=2>Dave, </FONT></SPAN></DIV>
<DIV><SPAN class=586291320-24032003><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=586291320-24032003><FONT size=2>I was just telling Chris that
it did work for me (partially) when he posted that it didn't work for him.
</FONT></SPAN></DIV>
<DIV><SPAN class=586291320-24032003><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=586291320-24032003><FONT size=2>I have a similar example that
was written specifically for IE but does sort of the same thing. Mine
has a function assigned to the onkeypress event to kill the event if the keyCode
is not a number to prevent bogus characters being typed in. Then another
function adds the dashes on the onkeyup event. I added my validateNumKey
and the onkeypress event handler to your example and it would tell me that the 2
on the numeric pad was 50 but the alert in your isPhone would report it as
98. The 98 then gets translated as a 'b' and that is probably why the
alert is being fired.</FONT></SPAN></DIV>
<DIV><SPAN class=586291320-24032003><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=586291320-24032003><FONT size=2>My function that handles the
onkeyup doesn't deal with the event (but I did test it and it also gets 98 for
the 2 on the numeric pad where it gets 50 in the validateNumKey
function).</FONT></SPAN></DIV>
<DIV><SPAN class=586291320-24032003><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=586291320-24032003><FONT size=2>Anyway, here are my two
functions. There is a text control that assigns the validateNumKey
function to the onkeypress event and the addDashes2 function to the onkeyup
event. I also have another function assigned to the onblur event to make
sure the dashes are there (that is to handle the case where the value is
Ctrl+V or mouse click pasted into the field). In this case, the
input text is named date and is in a form named form1.</FONT></SPAN></DIV>
<DIV><SPAN class=586291320-24032003><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=586291320-24032003><FONT size=2><INPUT TYPE=TEXT id=date
onkeyUp="addDashes2()" onkeypress="validateNumKey()" onblur="addDashes();"
MAXLENGTH=10></FONT></SPAN></DIV>
<DIV><SPAN class=586291320-24032003><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=586291320-24032003><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=586291320-24032003><FONT size=2>function validateNumKey
()<BR>{<BR> var inputKey = event.keyCode;<BR> var returnCode =
true;</FONT></SPAN></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><SPAN class=586291320-24032003><FONT size=2> if ( inputKey > 47
&& inputKey < 58 ) //
numbers<BR> {<BR> return;<BR> }<BR> else<BR> {<BR> returnCode
= false;<BR> event.keyCode = 0;<BR> }<BR> event.returnValue
= returnCode;<BR>}</FONT></SPAN></DIV>
<DIV><SPAN class=586291320-24032003><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=586291320-24032003><FONT size=2>function
addDashes2()<BR>{<BR> var currValue =
document.forms["form1"].date.value;<BR> var a = currValue.split
("/").join("");<BR> <BR> if ( a.length > 3 )<BR>
document.forms["form1"].date.value = a.substr(0,2) + "/" + a.substr(2,2) + "/" +
a.substr(4);<BR> else<BR> if ( a.length > 1 )<BR>
document.forms["form1"].date.value = a.substr(0,2) + "/" +
a.substr(2)</FONT></SPAN></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><SPAN class=586291320-24032003><FONT size=2> //if ( a.length == 10
)<BR> // tab to your next field<BR>}</FONT></SPAN></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma
size=2>-----Original Message-----<BR><B>From:</B> David Lovering
[mailto:dlovering@gazos.com]<BR><B>Sent:</B> Monday, March 24, 2003 01:35
PM<BR><B>To:</B> [JavaScript List]<BR><B>Subject:</B> Re: [Javascript]
Javascript or ASP.Net - Input Mask for Text Box thenAuto
Tab<BR><BR></FONT></DIV>
<DIV><FONT size=2>No, this was a simple demo on an old keyboard. The key
event masks are different for the number keys above the main keyboard than
they are for the number pad, but the conditionals could be easily extended to
cover even them. I could probably gen something together that would
recognize the number pad, ... if only I had a keyboard WITH a number
pad!</FONT></DIV>
<DIV><FONT size=2>[The reason I probably don't has something to do with the
fact that different manufacturers use different ROMs in their keyboards, and
hence generate slightly different key events.]</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>I could also modify the script to use a 'watch("keyUp",...)
trap instead of an event handler, which should make it generic enough to use
both the regular number keys and the number pad keys. </FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>Is this enough of a hint, or do you want me to tweak the
code a bit?</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>-- Dave Lovering</FONT></DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=lkmckinn@ingr.com href="mailto:lkmckinn@ingr.com">Mckinney, Lori
K</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=javascript@LaTech.edu
href="mailto:javascript@LaTech.edu">[JavaScript List]</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Monday, March 24, 2003 12:23
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> RE: [Javascript] Javascript or
ASP.Net - Input Mask for Text Box thenAuto Tab</DIV>
<DIV><FONT size=2></FONT><BR></DIV>
<DIV><SPAN class=425252519-24032003><FONT size=2>Are you using the number
pad? I get errors there but not with the number
keys.</FONT></SPAN></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma
size=2>-----Original Message-----<BR><B>From:</B> Chris Tifer
[mailto:christ@saeweb.com]<BR><B>Sent:</B> Monday, March 24, 2003 01:21
PM<BR><B>To:</B> [JavaScript List]<BR><B>Subject:</B> Re: [Javascript]
Javascript or ASP.Net - Input Mask for Text Box thenAuto
Tab<BR><BR></FONT></DIV>
<DIV><FONT size=2>I just tested this and it alerts me every time I try to
press a key. What's allowed with this script?</FONT></DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=dlovering@gazos.com href="mailto:dlovering@gazos.com">David
Lovering</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=javascript@LaTech.edu
href="mailto:javascript@LaTech.edu">[JavaScript List]</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Monday, March 24, 2003 2:14
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [Javascript]
Javascript or ASP.Net - Input Mask for Text Box thenAuto Tab</DIV>
<DIV><FONT size=2></FONT><BR></DIV>
<DIV><FONT size=2>A piece of cake. I did a similar "dynamic
filter" for phone numbers and toll-free numbers a while back, and I'm
enclosing the code I did it with. If you speak 'reg-ex' the masks
themselves should be self-explanatory, and if not, drop me a line
and we'll over it in detail. [The thing is semi-customized for
IE6+, but it wouldn't take much to make it viable under
Netscape].</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>-- Dave Lovering</FONT></DIV>
<DIV><FONT size=2>-- <A
href="mailto:dlovering@gazos.com">dlovering@gazos.com</A></FONT></DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=binklt@sosmail.state.mo.us
href="mailto:binklt@sosmail.state.mo.us">Binkley, Tammi</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A
title=javascript@LaTech.edu
href="mailto:'javascript@LaTech.edu'">'javascript@LaTech.edu'</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Monday, March 24, 2003
10:46 AM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> [Javascript] Javascript
or ASP.Net - Input Mask for Text Box then Auto Tab</DIV>
<DIV><FONT size=2></FONT><BR></DIV>
<DIV><SPAN class=375075017-24032003><FONT size=2>Using ASP.Net, I'm
trying to add an input mask to several Text Boxes which are date
fields. We want the date to appear "mm/dd/yyyy" in which the
user would only enter the actual numbers and the input mask would
insert the "/". Once this is achieved the function should auto
tab to the next field. I actually have a function for the auto
tab which works perfectly for ASP.Net, I am however, having a hard
time figuring out how to insert the "/" into the field. Any
suggestions?</FONT></SPAN></DIV>
<P><B><I><FONT face="Comic Sans MS" color=#800000>Tammi
Binkley</FONT></I></B> <BR><FONT face="Comic Sans MS"
color=#800000>Information Technology</FONT> <BR><FONT
face="Comic Sans MS" color=#800000>Missouri Secretary of State
Office</FONT> <BR><FONT face="Comic Sans MS" color=#800000>600 West
Main Street</FONT> <BR><FONT face="Comic Sans MS"
color=#800000>Jefferson City, MO 65101</FONT> <BR><B><FONT
face="Comic Sans MS" color=#800000>573-526-1242</FONT></B>
<BR><B><FONT face="Comic Sans MS"
color=#800000>binklt@sosmail.state.mo.us</FONT></B> </P>
<DIV><FONT size=2></FONT> </DIV>
<P></P><STRONG><FONT face="Comic Sans MS"
color=#800000></FONT></STRONG>
<HR>
<P></P>_______________________________________________<BR>Javascript
mailing
list<BR>Javascript@LaTech.edu<BR>https://lists.LaTech.edu/mailman/listinfo/javascript<BR></BLOCKQUOTE>
<P>
<HR>
<P></P>_______________________________________________<BR>Javascript
mailing
list<BR>Javascript@LaTech.edu<BR>https://lists.LaTech.edu/mailman/listinfo/javascript<BR></BLOCKQUOTE></BLOCKQUOTE>
<P>
<HR>
<P></P>_______________________________________________<BR>Javascript mailing
list<BR>Javascript@LaTech.edu<BR>https://lists.LaTech.edu/mailman/listinfo/javascript<BR></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>