Javascript Reference
Categories: SELECT

javascript SELECT focus( )

@July 7, 2008, 4:08 a.m.
focus( ) Firefox/Netscape/NN 2 IE 3 Chrome/Safari/DOM 1  

 

 

Gives focus from the current SELECT object, at which time the SELECT  object's onfocus event fires. Note that the range of elements capable of focus and blur (both the event and method) is limited in all browsers except for more recent versions of IE (see the shared tabindex attribute). Most reliably for backward compatibility, apply the focus( ) method to blatantly focusable elements, such as text input and textarea elements.

 

To give a text box focus and pre-select all the text in the box, use the sequence of focus( ) and select( ) methods on the element. If this sequence is to occur after windows change (such as after an alert dialog box closes), place the methods in a separate function, and invoke this function through the setTimeout( ) method following the alert( ) method for the dialog. This allows IE/Windows to sequence statement execution correctly.

 
Parameters

None.

 
Returned Value

None.


Powered by Linode.