Menu
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS R TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI GO KOTLIN SASS VUE DSA GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE
     ❯   

HTML accesskey 属性


定义和用法

accesskey 属性指定一个快捷键来激活/聚焦元素。

注意:在不同的浏览器中访问快捷键的方式会有所不同: 

浏览器 Windows Linux Mac
Internet Explorer [Alt] + accesskey N/A
Chrome [Alt] + accesskey [Alt] + accesskey [Control] [Alt] + accesskey
Firefox [Alt] [Shift] + accesskey [Alt] [Shift] + accesskey [Control] [Alt] + accesskey
Safari [Alt] + accesskey N/A [Control] [Alt] + accesskey
Opera Opera 15 或更新版本:[Alt] + accesskey
Opera 12.1 或更早版本:[Shift] [Esc] + accesskey

然而,在大多数浏览器中,快捷键可以设置为另一个组合键。

提示:如果多个元素具有相同的访问键,则其行为会有所不同

  • IE、Firefox:将激活具有按下的访问键的下一个元素
  • Chrome、Safari:将激活具有按下的访问键的最后一个元素
  • Opera:将激活具有按下的访问键的第一个元素

适用范围

accesskey 是 全局属性 的一部分,可以用于任何 HTML 元素。

元素 属性
所有 HTML 元素 accesskey

示例

两个具有指定访问键的超链接

<a href="https://w3schools.org.cn/html5" accesskey="h">HTML5</a><br>
<a href="https://w3schools.org.cn/css3" accesskey="c">CSS3</a>
自己尝试 »

浏览器支持

属性
accesskey

×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
[email protected]

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
[email protected]

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Copyright 1999-2024 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.