The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Can the Username Field be made Active upon Page Load?
When someone brings up the main vB 3.0 page, I would like the Username field to be automatically active. The focus should be there - that way as soon as the page loads, users can just start typing in order to log themselves in.
Can this be done without getting in the way of anything else that happens upon page load? |
#2
|
|||
|
|||
not too terribly difficult... you'll be editing the "navbar" template (about a quarter of the way down through the file). first you need to add a "name" attribute to the login form...
HTML Code:
<!-- login form --> <form action="login.php" method="post" onsubmit="md5hash(vb_login_password,vb_login_md5password)"> HTML Code:
<!-- login form --> <form action="login.php" method="post" name="vb_login_form" onsubmit="md5hash(vb_login_password,vb_login_md5password)"> Then just add the following javascript to the end of the login form section... HTML Code:
<script type="text/javascript"> document.vb_login_form.vb_login_username.focus(); </script> <!-- / login form --> |
#3
|
||||
|
||||
Wnorris, thank you!
That did the job quite well. Out of curiosity, on a similar question posted at vB.com - the concern came up that some vB elements require the onLoad in the body tag, and this mod was assumed to need to be triggered onLoad. Is there any concern that the code you provided will interfere with any other elements? |
#4
|
|||
|
|||
not at all... the onLoad portion of the body tag will be called regardless. the only time you might have a problem is if you had another element trying to get focus, in which case the last one to call focus() wins.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|