SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: Need onfocus()!

  1. #1
    SitePoint Wizard Wolf_22's Avatar
    Join Date
    Jul 2005
    Posts
    1,700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Need onfocus()!

    Could someone shine some light on this issue concerning onfocus? I need the textbox "pass" to have focus from the initial page load. I've tried everything to no avail.

    (x)HTML Code:
    Code:
    </head>
    <body>
    <form method="post" action="..." name="auth">
    <h4>Password:</h4>
    <input class="textBx" tabindex="1" type="password" name="pass">
    <input class="input" tabindex="2" type="submit" value="Submit" title="Submit">
    <input class="input" tabindex="3" type="button" value="Home" title="Home" onClick="window.location='Home'">
    </form>
    Any help is much appreciated.

  2. #2
    SitePoint Guru
    Join Date
    Apr 2006
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    put this in a script element in the head of your page,
    or as a file referenced by its src attribute.

    onload=function(){document.getElementsByName('pass')[0].focus()}


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
  •