Setting focus to the first form item on page load

Added By: rmtweb

(4 of 5) by 7.
Rate Snippet:
Description:  Ever wanted to have that top text box on your page have the focus when the page loads...follow this simple example!! This works by placing the Window_onLoad in the Header of either an HTM or ASP Page. If you wanted to select the second item in a form (eg if you have two boxes and want to auto-select the password box change the Elements(0) to Elements(1). You can also change the Forms(0) to the name of your form if you have named it, the Elements(0) can also be changed to the name of your form item you wish to set the focus to.
Language:  Visual Basic Script

Save to web space
E-mail Link

Code Snippet: