Edit This Code:
<!DOCTYPE html>
<html>
<body>

<a id="w3s" href="../index.html">W3Schools</a><br>
<a id="cnn" href="http://www.cnn.com/">CNN</a>

<p>The accesskey attribute specifies a shortcut key to activate/focus an element.</p>

<p>In this example, the keyboard key "w" is for w3schools.com, and "c" is for "cnn.com".</p>

<p><strong>Note:</strong> The shortcut varies from different browsers:</p>

<ul>
        <li>IE, Chrome, Safari, Opera 15+: [ALT] + <em>accesskey</em></li>
        <li>Opera prior version 15: [SHIFT] [ESC] + <em>accesskey</em></li>
        <li>Firefox: [ALT] [SHIFT] + <em>accesskey</em></li>
</ul>

<script>
document.getElementById("w3s").accessKey = "w";
document.getElementById("cnn").accessKey = "c";
</script>

</body>
</html>


Result:
Try it Yourself - © w3schools.com
Privacy Policy