|
| Index | Recent Threads | Unanswered Threads | Who's Online | User List | Help |
|
|
| No member browsing this thread |
|
Thread Status: Active Total posts in this thread: 4
|
|
| Author |
|
|
Stranger Joined: Aug 9, 2004 Post Count: 4 Status: Offline |
I'm having a consistent problem in developing forms. I have a form on a page will a number of input fields in it as well as a few links on the page before the header that are not in the form. When the form comes up, I have to hit the <tab> key once for the first input to recieve the focus (or click on it with the mouse). If I don't hit the tab key first and just start typing, the browser focus (mozilla) jumps to the link that contains the first letter I type. I have tried using the "tabindex" attribute, setting the first form <input> to "1" and all others to "0", but it makes no difference. I still have to hit the tab key first. Any ideas on how to make that first <input> tag recieve the focus by default? |
||
|
|
Advanced Member USA Joined: Nov 27, 2003 Post Count: 6285 Status: Offline |
Tab index is for giving links a priority. Default is the order in which they come in the source code. also consider that "0" likely cmes before "1". So if you use Tabindex you use 1 for the first field, 2, 3, 4, 5,..... you can't just set the others to "0". If you just set the tabindex 1 and nne others it goes back too default, could be you jump from field 1 to your first Nav. link. You should consider using accessKeys instead. |
||
|
|
Stranger Joined: Aug 9, 2004 Post Count: 4 Status: Offline |
OK, O'Reilly's book on HTML & XHTML states that the value "0" removes the link from the tabindex order. But what I'm after is to find a way that a link that is not the first link on the page can recieve the focus first thing. I know it can be done because I see web pages all the time that have header links before the first form <input> but that form <input> still gets the first focus, but I can't seem to find out how that first form field gets the focus right off the bat. |
||
|
|
Stranger Japan Joined: Feb 23, 2004 Post Count: 8 Status: Offline |
I know only a JavaScript solution: Use: <body OnLoad="document.MyFormName.MyInputName.focus();"> and at the very end of the html code (before "</body>") use: <script language="JavaScript"> document.MyFormName.MyInputName.focus(); </script> This "double-talk" you need because of the browser differences. Maybe one of each is enough, but right now I don't have time to check it out. See ya ... Coretys |
||
|
|
|
|
|
Current timezone is GMT May 20, 2013 10:54:12 AM |