Page 1 of 1

[SOLVED]How to focus cursor in textfield on page load PHP

Posted: Mon Jun 07, 2004 2:21 pm
by Calimero
When the page is laoded my visitors must click on the textfield to enter the search string.
How to automatise it, when the page loads you only need to type (because the cursor is in the the first textfield on the page)

Is this better done troug PHP or javascript...Better way no matter which is if possible.

Thanks ahead.[/big_search]

Posted: Mon Jun 07, 2004 2:37 pm
by feyd
only javascript would be able to do this..

you need to focus() the field onload.. like this:

Code: Select all

<body onload="document.forms.formname.fieldname.focus()">

<form name="formname"><input type="text" name="fieldname"></form>

I'll try it thanks, THIS SHORE WAS QUICK

Posted: Mon Jun 07, 2004 2:51 pm
by Calimero
AND SOMETHING IN THE BODY ... :D