MouseEvent.shiftKey

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

BCD tables only load in the browser

Ver más