SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Evangelist jazztie's Avatar
    Join Date
    Mar 2001
    Location
    the Netherlands
    Posts
    519
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I would like to set the focus to a text-field in a form after the window has completed loading.

    Somehow the following code doesn't work:

    <script language='JavaScript'>
    <!--
    onLoad='document.form.textfield.focus()';
    // -->
    </script>";

    When the window loads the particular textfield doesn't get the focus...

    Could someone help me with the code to make it work?
    Thanx...

  2. #2
    Bored One boredboi's Avatar
    Join Date
    Jul 2000
    Posts
    238
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmmm
    maybe instead of putting the onload within the script, put it in the body tag?

    like...
    <body onload="document.form.textfield.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
  •