Click Mouse on Main Menu Bar to Activate It!

Focus

What is focus? Focus is when something is active or highlighted. Example: When the cursor is in a form blinking. That form has the focus. The following are examples of how to use the focus command.



Focus to a text box when page loads.


See how the cursor is already in the form. Normally the cursor won't be in it. Put the following lines into your body tag.



An example is:
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#FF0000" VLINK="#000080" ALINK="#000080" onLoad="this.document.form1.a.focus();">
or
<body onLoad="this.document.form1.a.focus();">

And put this somewhere in your page.






Giving focus to a form and to having all the words inside it highlighted

Just copy the following lines.






Highlighting a text area


Now all you need to do is goto Edit and hit copy and BAM! You just copied that script!! To use this copy this code.



You can use this for regular text boxes as well!



Giving the focus to a button


See how the text in the button has a box around it. If you hit the space bar, you can press in the button. A more practical use for this is using the onLoad function. Here is the script.






Quick Note: To declare a certain form or button part of you code would look like this:
< body onLoad="document.form1.a.focus()">
In the onLoad command, "document" refers to the current document. "form1" refers to the the name of a from. "a" refers to the name of the input type within the form. "focus()" is the focus command ( "select()" selects all the text). This should help you if you want to create your own focus commands.