Selom
Selom

Reputation: 735

setFocus not working in mozilla

Im using form_name.textbox.focus() and it working fine in IE but not in mozilla. Can someone tell me how to handle this? this for answering.

Upvotes: 1

Views: 971

Answers (2)

Salman Arshad
Salman Arshad

Reputation: 272306

Give these a go:

document.form_name.textbox.focus()
document.form_name[ "textbox" ].focus()

Upvotes: 1

SLaks
SLaks

Reputation: 887887

You're using a non-standard IE behavior that turns all elements with IDs into global variables.
Since Firefox does not do this, form_name is undefined.

Change it to

document.getElementById("ID of <input> element").focus();

Upvotes: 4

Related Questions