Placing a focus

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bettina

    Placing a focus

    I have a text field and I want that after I enter a text in this text
    field, the focus goes to the button.gif. How can I do it? Any ideas?
    I know that when you use an input type="submit", the focus goes
    automatically to the button, but I don't want to use a button.

    See please the piece of code:
    <html>
    <head>
    <title>Untitl ed Document</title>
    <meta http-equiv="Content-Type" content="text/html;
    charset=iso-8859-1">
    </head>
    <body>
    <form name="formular" method="post" action="">
    <input type="text" name="mytextfie ld"><p>
    <input name="myButton" type="image" src="images/button.gif">
    </form>
    </body>
    </html>

    Thank you in advance. Bettina
  • lallous

    #2
    Re: Placing a focus

    Hello

    In IE, I would do:
    <input type="text" name="mytextfie ld" onkeypress="if (event.keyCode= =13)
    this.form.myBut ton.focus();">
    Or:
    <input type="text" name="mytextfie ld" onkeypress="if (event.keyCode= =13)
    this.form.submi t();"><p>

    --
    Elias

    "Bettina" <bcosta@tiscali net.ch> wrote in message
    news:7149c2e1.0 309120200.68fb6 14@posting.goog le.com...[color=blue]
    > I have a text field and I want that after I enter a text in this text
    > field, the focus goes to the button.gif. How can I do it? Any ideas?
    > I know that when you use an input type="submit", the focus goes
    > automatically to the button, but I don't want to use a button.
    >
    > See please the piece of code:
    > <html>
    > <head>
    > <title>Untitl ed Document</title>
    > <meta http-equiv="Content-Type" content="text/html;
    > charset=iso-8859-1">
    > </head>
    > <body>
    > <form name="formular" method="post" action="">
    > <input type="text" name="mytextfie ld"><p>
    > <input name="myButton" type="image" src="images/button.gif">
    > </form>
    > </body>
    > </html>
    >
    > Thank you in advance. Bettina[/color]


    Comment

    • Grant Wagner

      #3
      Re: Placing a focus

      Bettina wrote:
      [color=blue]
      > I have a text field and I want that after I enter a text in this text
      > field, the focus goes to the button.gif. How can I do it? Any ideas?
      > I know that when you use an input type="submit", the focus goes
      > automatically to the button, but I don't want to use a button.
      >
      > See please the piece of code:
      > <html>
      > <head>
      > <title>Untitl ed Document</title>
      > <meta http-equiv="Content-Type" content="text/html;
      > charset=iso-8859-1">
      > </head>
      > <body>
      > <form name="formular" method="post" action="">
      > <input type="text" name="mytextfie ld"><p>
      > <input name="myButton" type="image" src="images/button.gif">
      > </form>
      > </body>
      > </html>
      >
      > Thank you in advance. Bettina[/color]

      The focus doesn't "automatica lly" move to an <input type="submit" ...>
      after entering data in <input type="text" ...>.

      In some browsers, hitting the Enter key on your keyboard after entering
      data in the <input type="text" ...> will submit the form. In those
      browsers, hitting the Enter key on your keyboard after entering data
      should submit the form just fine, even with <input type="image" ...>.

      --
      | Grant Wagner <gwagner@agrico reunited.com>

      * Client-side Javascript and Netscape 4 DOM Reference available at:
      *


      * Internet Explorer DOM Reference available at:
      *
      Find official documentation, practical know-how, and expert guidance for builders working and troubleshooting in Microsoft products.


      * Netscape 6/7 DOM Reference available at:
      * http://www.mozilla.org/docs/dom/domref/
      * Tips for upgrading JavaScript for Netscape 7 / Mozilla
      * http://www.mozilla.org/docs/web-deve...upgrade_2.html


      Comment

      Working...