SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Apr 2003
    Posts
    170
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to have the text prompt loaded directly in the search box ?

    On my directory I have a search box, and I would like the text prompt to be loaded automatically there when user load my page, so they can start writing their search query without having to first point in the search box with the mouse.

    How can this be easily done ?

    Thanks in advance,
    Koros

  2. #2
    Take The Blue Pill neilmerton's Avatar
    Join Date
    Jul 2004
    Location
    Leicester, UK
    Posts
    871
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <body onload="document.form_name.input_name.focus();">

    change "form_name" to the name of your form, and change "input_name" to the name of the input field.

  3. #3
    SitePoint Zealot
    Join Date
    Apr 2003
    Posts
    170
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok thanks, it works, but what I don't like is that when you press the back button of the browser, it forces the previous page to load from the top instead than from where you were. This is annoying when you are in the bottom of a page and get back to it. Isn't there a way to prevent this ?

    Cordially,
    Koros


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
  •