567.html (876B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 5 <title>A <div> with role "button" followed by a modification to the value of "checkbox".</title> 6 <script> 7 function changeRole (/* Element */ element, /* String */ newRole) { 8 element.setAttribute ('role', newRole); 9 element.innerHTML = "This <div> has role '" + newRole + "'"; 10 } 11 </script> 12 </head> 13 <body> 14 <div role="button" id="test" tabindex="0" onclick="changeRole (this, 'checkbox');" onkeydown="changeRole (this, 'checkbox');">This <div> has role 'button'</div> 15 <p> 16 <button onclick="changeRole (document.getElementById ('test'), 'checkbox')" type="button">Change Role</button> 17 <button onclick="window.location.reload()" type="button">Reload Page</button> 18 </p> 19 </body> 20 </html>