MouseEvent.shiftKey
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
Please help us by answering a few questions.
El evento de MouseEvent.shiftKey
es una propiedad de solo lectura que indica si la tecla de shift se presionó (true
) o no (false
).
Sintaxis
var shiftKeyPressed = instanceOfMouseEvent.shiftKey
Valor que retorna
Un valor booleano
Ejemplo
js
<html>
<head>
<title>Ejemplo de shiftKey</title>
<script type="text/javascript">
function showChar(e){
alert(
"Tecla presionada: " + String.fromCharCode(e.charCode) + "\n"
+ "charCode: " + e.charCode + "\n"
+ "SHIFT presionada: " + e.shiftKey + "\n"
+ "ALT presionado: " + e.altKey + "\n"
);
}
</script>
</head>
<body onkeypress="showChar(event);">
<p>Presione cualquier tecla, con o sin la tecla SHIFT.<br />
También puede utilizar SHIFT junto a la tecla ALT.</p>
</body>
</html>
Especificaciones
Specification |
---|
UI Events # dom-mouseevent-shiftkey |
Compatibilidad con navegadores
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
shiftKey |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.