Re: Php function to Set focus On A form Field

From: Date: Wed, 26 Apr 2006 06:41:58 +0000
Subject: Re: Php function to Set focus On A form Field
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-234784@lists.php.net to get a copy of this message
marvin hunkin schrieb:
Hi. is there any php or java script function, where i can embed into my php or html file, to set focus on to the first form field, like a text box, to go to that field first, and not to go to the link or button first. if there are any tips, tricks, or links or code examples, how to fix this problem. let me know. cheers Marvin.
Hi. It is not possible to do that using PHP but you can use JavaScript instead. I recommend the function focus(). For example: <BODY OnLoad="document.nameform.user.focus();"> Check this tiny tutorial: http://javascript.internet.com/page-details/focus-onload.html Did you already remarked that http://www.google.com is using this function to automatically set the focus on the search field. regards Philipp

« previous php.general (#234784) next »