Click Event onclick
An onclick event is generated when you click the mouse button. At the same time, the event processing specified by onclickProgramOrCodeWill be called for execution. Usually generated in the following basic objects:
Button (Button Object)
Checkbox (check box) or (check list box)
Radio (single button)
Reset buttons (important button)
Submit buttons (submit button)
All text and images
For example, you can use the following buttons to activate alert ():
<HTML>
<Head>
</Head>
<Body>
<Form>
<Input type = "button" value = "hello" onclick = "alert ('Hello! I'm JavaScript ') ">
</Form>
</Body>
</Html>
The running result is as follows:
Click Event onclick
Prompt after clicking
After the onclick equal sign, you can use your own functions as the event processing program, or use internal functions in JavaScript. You can also directly use JavaScript code.