HTML accesskey attribute
accesskey
The purpose of the HTML accesskey attribute is to specify the access key for accessibility/screen reading.
Supported elements
HTML accesskey attribute supports a, area, button, input, label, legend and textarea.
Syntax
<ElementName accesskey="value" >.....</ElementName>
Where ElementName is any of the supported elements.
Type of value
Type of value of HTML accesskey attribute is a character.
Value
An alphabet.
Default value
There is no default value of HTML accesskey attribute.
Supported doctypes
HTML 4.01 strict, HTML 4.01 transitional, HTML 4.01 frameset.
Example of HTML accesskey attribute with a
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Example of HTML accesskey attribute with form </title>
</head>
<body>
<p><a href="/index.php" accesskey="I">Index Page</a></p>
</body>
</html>
Result
View this example in a separate browser window
Example of HTML accesskey attribute with a.
Example of HTML accesskey attribute with button, input, label, legend and textarea
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><!-- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> -->
<title>Example of HTML accesskey attribute with button, input, label, legend and textarea</title>
</head>
<body>
<form action="action.php">
<fieldset>
<legend accesskey="P">Personal Information</legend>
<label accesskey="M">First Name:</label> <input name="fname" accesskey="F"/><br/>
<label accesskey="T">Last Name:</label> <input name="fname" accesskey="L"/><br/>
<label accesskey="E">email: </label><input name="email" accesskey="M"/><br/>
</fieldset>
<fieldset>
<legend accesskey="C">Career</legend>
<label accesskey="X">Years of experience:</label> <input name="eo" accesskey="Y"/><br/>
<label accesskey="U">Industry:</label> <input name="industry" accesskey="N"/><br/>
</fieldset>
<button type="button" name="Submit" accesskey="S">Submit</button>
</form>
</body>
</html>
Result
View this example in a separate browser window
Example of HTML accesskey attribute with button, input, label, legend and textarea.
Example of HTML accesskey attribute with area
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Example of HTML accesskey attribute with area</title>
</head>
<body>
<img src="attributes-accesskey-map.gif" alt="accesskey map example " width="308" height="190" border="0" usemap="#Map">
<map name="Map">
<area shape="rect" coords="8,5,100,77" href="../../mysql/mysql-tutorials.php" target="_blank" alt="mysql tutorial" accesskey="M">
<area shape="circle" coords="155,93,59" href="../../php/php-home.php" target="_blank" alt="php tutorial" accesskey="P">
<area shape="rect" coords="197,136,306,188" href="../../sql/sql-tutorials.php" alt="sql tutorials" accesskey="S">
</map>
</body>
</html>
Result
View this example in a separate browser window
Example of HTML accesskey attribute with area.
Previous: HTML accept attribute
Next: HTML action attribute
Test your Programming skills with w3resource's quiz.
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://w3resource.com/html/attributes/html-accesskey-attribute.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics