Focus a cursor in the search field

12
Found 3rd Nov 2009
Ive just designed a webstie and the main area is a search box, how do i make the cursor go straight to the search box ready to type when page loads, like google for example...

thanks

  1. Misc
Groups
  1. Misc
12 Comments

check google's html?

Maybe something like this?

"onload="document.f.q.focus()"

Original Poster

do i put that before /head?

max401;6768852

do i put that before /head?



I don't have a clue mate, that's the bit from google's page which looks most likely but you need someone that knows what they're doing. I probably could've worked this out 10 years ago but not anymore!

there is a bit about it ]here, might help, might not.

catinthehat;6769243

there is a bit about it ]here, might help, might not.

.........although its for forms, so might not.

Original Poster

cant seem to get it working with any of them/... this is my input field and button...





Maybe the smiley in there is causing the problem???

You haven't told us your form name, so replace YOURFORM with the name of your form!











Original Poster

Ambdon;6770160

You haven't told us your form name, so replace YOURFORM with the name of … You haven't told us your form name, so replace YOURFORM with the name of your form!

Benjimoron;6769562

Name: Free JavaScripts providedby The JavaScript Source



Why don't you just use that???

max401;6773803
is this it?



and the id is the form name?


Try changing it to:



and then adding:
Post a comment
Avatar
@
    Text
    Top Discussions
    1. Whats a great pair of pc speakers.My son does his ps4 but also guitar writi…34
    2. Looking for the cheapest Tall Fridge Freezer11
    3. BT Infinity Router33
    4. Ps4 pro or Xbox one x918

    See more discussions