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. Advertising

  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. Advertising

  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. Advertising

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. M P
    Replies:
    1
    Views:
    505
  2. max
    Replies:
    2
    Views:
    388
    Lambik
    Apr 1, 2007
  3. Steve Swift
    Replies:
    4
    Views:
    98
    Steve Swift
    Sep 2, 2006
  4. HopfZ
    Replies:
    0
    Views:
    302
    HopfZ
    Jan 8, 2007
  5. Roger
    Replies:
    3
    Views:
    351
Loading...

Share This Page