I have a very basic php page that really just displays the standard menu items for the site plus a search box using a form and submit button. How do I get it so that the cursor is in the search box and the user can just start typing, rather than having to click in the box first? Google does it if you can't understand what I am saying.
This is just a simple javascript code. In <head> add this: <script> <!-- function focus(){document.FORM_NAME.INPUT_NAME.focus();} // --> </script> And then in <body>: <body onLoad=focus()>
This syntax is not standard - only elements in HTML collections can be accessed using this notation (i.e. using id's as JS identifiers). This syntax will work in all DOM-compliant browsers: document.getElementById("input-id").focus(); input-id must be the value of the ID attribute of the input element, not name. J.D.