Appendix JS_C_A2

 

Summary

Requirement: All functionality is operable through a keyboard interface.

Details: Use the click event of links and buttons as an activation event.

Examples

Correct code

Refer to the JS_C_A2 live demo for a working example.

<button id="demo" type="button">Click Me</button>
document.getElementById('demo').addEventListener('click', function()
{
    alert('The button\'s click event fired');
 
}, false);

Incorrect code

Requirement: All functionality is operable through a keyboard interface.

Details: Use the click event of links and buttons as an activation event.

<input type="button" 
    value="Compute Monthly Pay" onkeypress="compute()">