SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Threaded View

  1. #1
    SitePoint Member
    Join Date
    Jul 2007
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Is it possible to set the FOCUS() dynamically with javascript

    hi,
    This below code is working for IE but not working for FIREFOX....


    Code:
    <html>
    <head>
    <script language="JavaScript">
     
     function checkme(strVal){
     var id=strVal;
                alert(id);
         //document.all[strVal].focus();---->(IE) FOR IE it is working but not working for mozilla firefox
         document.forms[strVal].focus(); //(FIREFOX)
     }
    </script>
    </head>
    <body>
    <form>
    NAME..<input type="text" name="empName" size="5" maxlength="4" onChange="checkme(this.value)"/><br>
    ID....<input type="text" name="id" value=""/><br>
    DEPT..<input type="text" name="dept" value=""/><br>
    </form>
    </body>
    </html>


    thx & rgds,

    Ajay.
    Last edited by AJAY KUMAR; Jul 5, 2007 at 20:40.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •