<!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>&nbsp;</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.&nbsp; 
</FONT></SPAN></DIV>
<DIV><SPAN class=586291320-24032003><FONT size=2></FONT></SPAN>&nbsp;</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.&nbsp;&nbsp;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.&nbsp; Then another 
function adds the dashes on the onkeyup event.&nbsp; 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.&nbsp; 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>&nbsp;</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>&nbsp;</DIV>
<DIV><SPAN class=586291320-24032003><FONT size=2>Anyway, here are my two 
functions.&nbsp; There is a text control that assigns the validateNumKey 
function to the onkeypress event and the addDashes2 function to the onkeyup 
event.&nbsp; 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&nbsp;or mouse click&nbsp;pasted into the field).&nbsp; 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>&nbsp;</DIV>
<DIV><SPAN class=586291320-24032003><FONT size=2>&lt;INPUT TYPE=TEXT id=date 
onkeyUp="addDashes2()" onkeypress="validateNumKey()" onblur="addDashes();" 
MAXLENGTH=10&gt;</FONT></SPAN></DIV>
<DIV><SPAN class=586291320-24032003><FONT size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=586291320-24032003><FONT size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=586291320-24032003><FONT size=2>function validateNumKey 
()<BR>{<BR>&nbsp;var inputKey =&nbsp; event.keyCode;<BR>&nbsp;var returnCode = 
true;</FONT></SPAN></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><SPAN class=586291320-24032003><FONT size=2>&nbsp;if ( inputKey &gt; 47 
&amp;&amp; inputKey &lt; 58 ) // 
numbers<BR>&nbsp;{<BR>&nbsp;&nbsp;return;<BR>&nbsp;}<BR>&nbsp;else<BR>&nbsp;{<BR>&nbsp;&nbsp;returnCode 
= false;<BR>&nbsp;&nbsp;event.keyCode = 0;<BR>&nbsp;}<BR>&nbsp;event.returnValue 
= returnCode;<BR>}</FONT></SPAN></DIV>
<DIV><SPAN class=586291320-24032003><FONT size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=586291320-24032003><FONT size=2>function 
addDashes2()<BR>{<BR>&nbsp;var currValue = 
document.forms["form1"].date.value;<BR>&nbsp;var a = currValue.split 
("/").join("");<BR>&nbsp;<BR>&nbsp;if ( a.length &gt; 3 )<BR>&nbsp; 
document.forms["form1"].date.value = a.substr(0,2) + "/" + a.substr(2,2) + "/" + 
a.substr(4);<BR>&nbsp;else<BR>&nbsp; if ( a.length &gt; 1 )<BR>&nbsp;&nbsp; 
document.forms["form1"].date.value = a.substr(0,2) + "/" + 
a.substr(2)</FONT></SPAN></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><SPAN class=586291320-24032003><FONT size=2>&nbsp;//if ( a.length == 10 
)<BR>&nbsp;// 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.&nbsp; 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.&nbsp; 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>&nbsp;</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.&nbsp; </FONT></DIV>
  <DIV><FONT size=2></FONT>&nbsp;</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>&nbsp;</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?&nbsp; 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.&nbsp; 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.&nbsp; If you speak 'reg-ex' the masks 
        themselves should be self-explanatory, and if&nbsp;not, drop me a line 
        and we'll over it in detail.&nbsp; [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>&nbsp;</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.&nbsp; 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 "/".&nbsp; Once this is achieved the function should auto 
          tab to the next field.&nbsp; 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.&nbsp; 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>&nbsp;</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>