RE: [PHP] Re: Php function to Set focus On A form Field
| From: | Ing. Edwin Cruz | Date: | Wed, 26 Apr 2006 15:16:26 +0000 |
| Subject: | RE: [PHP] Re: Php function to Set focus On A form Field | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-234820@lists.php.net to get a copy of this message | ||
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@gmail.com]
Enviado el: Miércoles, 26 de Abril de 2006 01:42 a.m.
Para: php-general@lists.php.net
Asunto: [PHP] 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