ZVON > References > DOM2 Reference

focus (method )

Owning interface and usage:  
HTMLInputElement.focus()

Member of these other interfaces:  
none

Description:  
Gives keyboard focus to this element.

Parameters:  
none

Returns:  
nothing

Exceptions:  
none


Example:
Source:
   <INPUT id="textInput" type="text" value="text-to-enter"></INPUT>
JavaScript:
  function focusInput() {
    var main = document.getElementById('textInput');
    main.focus();
  }
  function blurInput() {
    var main = document.getElementById('textInput');
    main.blur();
  }
Try it:    
See it: