■ It is widely used in sign-up forms to accept an individual’s username and password.
■ It is of use in fixing the arrangement of elements on a page and deciding to load them selectively. Thus, it is of help in creating better page layouts.
■ It can be used to hide information and disclose it on user action. For example, clicking on the ‘read more’ button discloses information which was hidden on page load, or clicking on a ‘Yes’ or ‘No’ button leads you to a page/section you weren’t shown by default.
■ It can be used to store IP addresses of visitors and record their page visits.
■ It can be used to test browser actions and fix browser issues.
The first example is a simple one and commonly seen in menu items. If you move your mouse over some link or menu button, it changes color. This change of color on user action, can be used to give different visual effects and also enhance the look of a web page. In the example below, take your mouse over the button of your choice and see it change to the respective color.
This is a perfect example of an event. We come across something similar on several web pages. On the event of clicking a button, a message is displayed. It may tell you what to do next or inform you of something useful. In the example below, a simple message is displayed on clicking the button.