JavaScript focus problem when pressing enter in IE

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • karthickkuchanur
    New Member
    • Dec 2007
    • 156

    JavaScript focus problem when pressing enter in IE

    Hi,

    I have the text one text box and submit button.

    i used
    Code:
     document.getElementById("find").focus();
    to focus the find button when the user enter the value in text box and PRESS enter(With out click).

    The value is correcty dispalyed (Filtering)in Fire Fox.

    But it is not working for IE.

    When i enter the value in text box and make it focus by using tab key for find button ,in this case it working.


    Please help me how to make my button to focus correctly for IE ..

    Eg : I will enter the value in test and simple press the enter.

    Note : it is working in FIRE FOX.
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    How is this triggered? Can you post some more relevant code?

    Comment

    • karthickkuchanur
      New Member
      • Dec 2007
      • 156

      #3
      Hi Acoder,

      In My HTML page we have the script like <code><script type="text/javascript">
      document.getEle mentById("find" ).focus();
      </script> </code>

      So it will focus the find key button.

      Below is code for button <code> <td colspan="2" align="right" class="odd">
      <input type="submit" class="boton" jwcid="reset@Bu tton" onclick="submit Form(this.form) ">Reset</input>
      &nbsp;
      <input "submit" class="boton" value="Find" jwcid="find@Sub mit" listener="ognl: listeners.handl eSubmitButtonCl ick"/>
      </td> </code>

      please reply me if need more info .Thanks

      Comment

      • karthickkuchanur
        New Member
        • Dec 2007
        • 156

        #4
        Hi,

        Code:
          <script type="text/javascript">
               document.getElementById("find").focus();
             </script>
        Whilw laoding the script is get called while the html is loaded, at this time reset button got focus scope (FIREFOX)

        Below the button code
        Code:
        <td colspan="2" align="right" class="odd"> 
                  <input type="submit" class="boton" jwcid="reset@Button" onclick="submitForm(this.form)">Reset</input> 
                  &nbsp;
                   <input "submit" class="boton" value="Find" jwcid="find@Submit" listener="ognl:listeners.handleSubmitButtonClick"/>  
               </td>
        Please reply if u want more info. Thanks

        Comment

        Working...