Or if you have header.inc.php and the body tag is global then in your form.inc.php(for example) or in your template, you can do this: <script> Window.onLoad=function(){ document.nameform.inputField.focus(); } </script> Regards! -----Mensaje original----- De: Philipp Kopf [mailto:philipp.kopf@xxxxxxxxx] Enviado el: Miércoles, 26 de Abril de 2006 01:42 a.m. Para: php-general@xxxxxxxxxxxxx Asunto: Re: Php function to Set focus On A form Field 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php