RE: [PHP] How to set focus in a form field

From: Date: Thu, 11 Jul 2002 15:33:13 +0000
Subject: RE: [PHP] How to set focus in a form field
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-107156@lists.php.net to get a copy of this message
You can do it with JavaScript. Something like: <script language="JavaScript"> document.formname.fieldname.focus(); </script> At the bottom of the page, replacing formname and fieldname with the appropriate values, obviously... HTH Richy ========================================== Richard Black Systems Programmer, DataVisibility Ltd - http://www.datavisibility.com Tel: 0141 435 3504 Email: rblack@datavisibility.co.uk -----Original Message----- From: Andre Dubuc [mailto:aajdubuc@webhart.net] Sent: 11 July 2002 16:26 To: php-general@lists.php.net Subject: [PHP] How to set focus in a form field I have an annoying 'glitch' in the forms on my site: When a page loads, if it has a form on it, I would like the cursor to move to the first field, be 'set' - that is, I should see a cursor or blinking cursor in the first field. As it is now, on some pages, I either have to 'tab' to the first field, or click themouse in that field. Is there anyway to automate this, so that when a page loads it automatically goes to the first field, and 'highlights' the entry area? (Btw, I tried 'tabindex=1' but it still does not do what I'd like it to. Any ideas, suggestions, or admontions gratefully accepted. Tia, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#107156) next »