Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

« Previous Version 5 Current »

Content Freeze

As of July 25th, 2023, there is a content freeze on this page.

The onfocus event activates when an element receives focus.  The event can be specified as a JavaScript expression or the name of a JavaScript function.  

If an expression is used, the JavaScript keyword this refers to the element that received focus.  

If the name of a function is used, the function will receive 2 parameters when called: 

  • The browser event object
  • A reference to the element that received focus

Example:

The following would draw a red border around the element once it receives focus.

onfocus: this.style.border = "1px solid red";

  • No labels