JavaScript is an object based language.The basic characteristics of object-basedWebsite DesignEvent driven.The actions of the user using the mouse or hotkey on the client side are called events, and the actions of a series of programs triggered by the mouse or hotkey are called event driven.There are mainly the following events:
Click Event (onClick)
WhenMarketing website constructionWhen the user clicks the mouse button, the onClick event is generated, and the event handler specified by onClick will be called to execute.Generally, click events are applied to buttons, checkboxes, radio buttons, reset buttons, and submit buttons.
For example:
Save the above code as "onclick. htm", open it with a browser, click "Click Me", and the result is as shown in Figure 1.21. Change event (onChange)
Save the above code as "onchange. htm", open it with a browser, change the value of the text box, and the page prompt is shown in Figure 1.22.Once the value of the text box changes, the onChange event is triggered and the check function is executed.
Selected event (onSelect)
Save the above code as "onselect. htm", open it with a browser, and select some text in the text field, as shown in Figure 1.23.
Load event (onLoad)
Save the above code as "onload. htm" and open it with a browser, as shown in Figure 1.24.
The loading event is executed when you first enter the page.
Unload event (onUnload)
Save the above code as "onunload. htm" and open it with a browser, as shown in Figure 1.25. The unload event is executed when leaving the page.