Focusing on Your First Form Field
I've had mixed results with scripts that attempted to set the focus on individual form fields, but this one has worked well for me in a number of situations. First, place this script right before </head>:

<script type="text/javascript">
// This will focus first non-hidden text or textarea field on the first form.
function focus_first ()
{
    var form = document.forms[0];
    if (form != null && form.elements[0] != null)
    {
        for (var i = 0; i < form.elements.length; ++i)
        {
            var field = form.elements[i];
            if (field.type!="hidden" && (field.type=="text" || field.type=="textarea"))
            {
                field.focus();
                break;
            }
        }
    }
}
</script>

Then, make sure your <body> tag includes onload="focus_first()", like:

<body onload="focus_first()">


Archives