Checkbox.onClick
JavaScript 1.1+, JScript 3.0+ Nav3+, IE 4+ Syntax
onClick="command"
Description
The onClick event handler is defined in an <input> tag and specifies what to do when a check box is clicked.
Example
The code in Listing 7.45 uses the onClick event handler to display a message alerting the customer that sausage goes well with peppers.
Listing 7.45 Use onClick Event Handler to Display Message
<html> <h2>Pizza Machine</h2> Step 1: Please select your pizza toppings:<BR> <form name="orderForm"> <input type="checkbox" name="peppers" onClick="recommendSausage()">Peppers<br> <input type="checkbox" name="sausage">Sausage<hr> Step 2: <input type="button" value="Order Pizza" name="orderButton" onClick="alert('Your pizza has been ... |
Get Pure JavaScript now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.