Sometimes focus on a specific form element will not work in Firefox.
To make it work in Firefox, we can use settimeout function.
The function setTimeout() executes the javascript code after a specified time interval.
Syntax : setTimeout(“javascript statement”,milliseconds);
The first parameter of setTimeout() is a string that can contain any JavaScript statement.
The second parameter indicates how many milliseconds from now we want to execute the first parameter.
To focus on a particular form element, we can give the following statement :
settimeout(function() { ptr.focus();} , 0) where ‘ptr’ is the form element.
October 22, 2008 at 9:59 am
Nice Article for developers
Mayank
October 22, 2008 at 11:23 am
Very informative. Keep it up Sri.