Advancing Text Field Focus with the Period key besides TAB; IE vs firefox

Discussion in 'Javascript' started by henrywuxg@gmail.com, Nov 21, 2006.

  1. Guest

    Hi All,

    I would like to use Period Key(.) besides Tab to toggle from one
    textbox to another when user is editing IP addresses, which have four
    textboxes. The function in below works fine with IE5, but it has
    strange problem with Firefox 1.5.0.8.

    <!--
    <td>IP Address
    <input type="text" size="3" maxlength="3" name="ip_1"
    onkeypress="return focusNext(this.form,'ip_2',event)">.
    <input type="text" size="3" maxlength="3" name="ip_2"
    onkeypress="return focusNext(this.form,'ip_3',event)">.
    <input type="text" size="3" maxlength="3" name="ip_3"
    onkeypress="return focusNext(this.form,'ip_4',event)">.
    <input type="text" size="3" maxlength="3" name="ip_4"
    onkeypress="return focusNext(this.form,'ip_4',event)">
    </td>
    -->

    function focusNext(form, elemName, evt)
    {
    evt = (evt) ? evt : event;
    var charCode = (evt.charCode) ? evt.charCode : ((evt.which) ?
    evt.which : evt.keyCode);
    if (charCode == 46) {
    form.elements[elemName].focus( );
    return false;
    }
    return true;
    }
    // source from <<Javascript and DHTML Cookbook>>

    If you try with Firefox, besides focusing to next textbox, the period
    is wrongly kept in previous one.

    Thanks for any help

    Henry
     
    , Nov 21, 2006
    #1
    1. Advertisements

  2. ASM Guest

    Re: Advancing Text Field Focus with the Period key besides TAB; IEvs firefox

    a écrit :
    > Hi All,
    >
    > I would like to use Period Key(.) besides Tab to toggle from one
    > textbox to another when user is editing IP addresses, which have four
    > textboxes. The function in below works fine with IE5, but it has
    > strange problem with Firefox 1.5.0.8.


    no problemo with Firefox 2 (on Mac)

    --
    Stephane Moriaux et son (moins) vieux Mac déjà dépassé
    Stephane Moriaux and his (less) old Mac already out of date
     
    ASM, Nov 21, 2006
    #2
    1. Advertisements

  3. Guest

    ASM wrote:
    > a écrit :
    > > Hi All,
    > >
    > > I would like to use Period Key(.) besides Tab to toggle from one
    > > textbox to another when user is editing IP addresses, which have four
    > > textboxes. The function in below works fine with IE5, but it has
    > > strange problem with Firefox 1.5.0.8.

    >
    > no problemo with Firefox 2 (on Mac)
    >


    Thanks.
    Does anyone have the same on Firefox 1.5 on window?
     
    , Nov 22, 2006
    #3
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Otis Mukinfus
    Replies:
    2
    Views:
    731
    Otis Mukinfus
    Jan 14, 2007
  2. Karen Grube

    Urgent: How can I get the enter key to behave like a tab key?

    Karen Grube, Nov 28, 2004, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    482
    Karen Grube
    Nov 29, 2004
  3. M P
    Replies:
    1
    Views:
    833
  4. J. VerSchave
    Replies:
    4
    Views:
    262
    Yann-Erwan Perio
    Sep 23, 2004
  5. max
    Replies:
    2
    Views:
    558
    Lambik
    Apr 1, 2007
  6. Steve Swift
    Replies:
    4
    Views:
    157
    Steve Swift
    Sep 2, 2006
  7. HopfZ
    Replies:
    0
    Views:
    492
    HopfZ
    Jan 8, 2007
  8. Roger
    Replies:
    3
    Views:
    610
Loading...