views:

27

answers:

2

Hi, 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.

+3  A: 

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();
SLaks
thanks dude. it works perfectly
Selom
Why was this downvoted?
SLaks
+1  A: 

Give these a go:

document.form_name.textbox.focus()
document.form_name[ "textbox" ].focus()
Salman A
This will not help at all.
SLaks
I've revised my answer, it works in FF and IE.
Salman A
Note that `form_name` is not the `<form>`'s `ID`.
SLaks