[thelist] js problem

Peter-Paul Koch gassinaumasis at hotmail.com
Fri Sep 13 16:44:01 CDT 2002


> > why not ditch the global variable and call your defaultFocus()
> > function, passing the field you want to focus?
> >
> > function defaultFocus(oElement)
> > {
> >   oElement.focus();
> > }
> >
> > and call it like this:
> >
> > defaultFocus(document.forms[0].elements['lastname']);
>
>This throws an error in IE6 "document.forms.0.elements is null or not
>an object". I tried naming my form and using that name in the form
>array, which didn't work either. I made sure my element had
>name="lastname" in it as well, it also has the same id.

Then the forms array isn't initialized at the moment you execute
defaultFocus(), which means the page hasn't finished loading yet. Yet you
say you call it onLoad...

We need to see the page to solve this one. URL please, no code in body of
mail.

ppk

_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com




More information about the thelist mailing list