Focus a cursor in the search field

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

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. Better watch out for these...914
    2. Just heard this...2 ★★★★★★★★★★★★★★ congrats to all on 392k ★★★★★★★★★★★★★★7763990
    3. Any PS4 News Here29213595
    4. ❅☁☁❅ I want☼to talk☼about the☔WEATHER☔no politics☃no religion❅☁☁❅18846087

    See more discussions