logo

New Response

« Return to the main article

You are replying to:

    • avatar
    • Kurt
    • Posted on Sat 1 May 2004

    I have been tasked with creating a template that not matter what the name of the field, when loaded via a browser, it will automagically go to the first field.

    I use the "onLoad": document.forms[0].elements[0].focus()

    For whatever reason, this won't recognize the first field.

    If I use "onLoad": document.forms[0].first.focus() and name the field "first" it works fine.

    I prefer using the elements[0] method so I don't have to dictate field names. This is a basic template that will be used to make custom forms. Because of all the other elements required, I am using a subform to store the input fields.

    Any thoughts as to why this isn't working?

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment: