Web Hosting Talk







View Full Version : Google > How do they do it?


PencWeb
06-20-2002, 09:17 PM
go to www.google.com and look at that text field. For me, the cursor is already blinking before I click is... How did they do it? I tried to figure it out, and I need to know for this chat script I'm making.


Thanks!
- Shawn

21inchguns
06-20-2002, 09:26 PM
This is what does it::

function sf(){document.f.q.focus();}

then throw a call to that in the onload......(and obviously rename to match your own form fields

michaeln
06-20-2002, 09:27 PM
This is how they did it.
They named their form f like this <form name="f"> and they named that particular input field q like this <input name="q">

In the header they defined this function as javascript:
<script>
function sf(){document.f.q.focus();}
</script>

Then they called that function when the page loads by placeing the following in the body tag:
OnLoad=sf()

I hope that helps.

Regards,
Micheal

EDIT: I see 21inchguns posted just before me... ;)

iamdave
06-20-2002, 10:21 PM
JavaScript

Roy@ENHOST
06-21-2002, 01:00 AM
You can try taking a peek at the source code from View>Source
;-)

PencWeb
06-21-2002, 10:35 AM
Thanks so much guys! I really appreciate it ;)
And yes, I did look at the source, hehe