Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Détecter la touche Shift ?

11 réponses
Avatar
Pierre Goiffon
En vue de permettre des sélections multiples simplifiées en faisant un
clic, puis un 2eme clic avec la touche shift enfoncée (=> l'intervalle
entre les 2 clics est sélectionné), je cherche à savoir comment faire
pour détecter sur on click que l'on a la touche Shift enfoncée ?

10 réponses

1 2
Avatar
Laurent vilday
je cherche à savoir comment faire
pour détecter sur on click que l'on a la touche Shift enfoncée ?


<http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html#Events-MouseEvent-shiftKey>
<http://developer.mozilla.org/en/docs/DOM:event.shiftKey>
<http://developer.mozilla.org/en/docs/DOM:event.shiftKey>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script>
function detection(e)
{
var elt = document.getElementById('result');
e = e || event;
elt.innerHTML = e.shiftKey ? 'AVEC' : 'SANS';
return true;
}

window.onload = function()
{
document.body.onclick = detection;
};
</script>
</head>

<body>
<p>ETAT de la touche SHIFT : <span id="result"></span></p>
<p>lorem ipsum dolor sit amet lorem ipsum dolor sit amet</p>
<p>un peu de contenu</p>
</body>

</html>

--
laurent

Avatar
Pierre Goiffon
Laurent vilday wrote:
je cherche à savoir comment faire pour détecter sur on click que l'on
a la touche Shift enfoncée ?


function detection(e)
{
var elt = document.getElementById('result');
e = e || event;
elt.innerHTML = e.shiftKey ? 'AVEC' : 'SANS';
return true;
}


Merci Laurent, je vais regarder ça !


Avatar
Laurent vilday
je cherche à savoir comment faire pour détecter sur on click que l'on
a la touche Shift enfoncée ?


<http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html#Events-MouseEvent-shiftKey>

<http://developer.mozilla.org/en/docs/DOM:event.shiftKey>
<http://developer.mozilla.org/en/docs/DOM:event.shiftKey>


Erreur de copié/collé :)

<http://msdn2.microsoft.com/en-us/library/ms534629.aspx>

--
laurent


Avatar
Pierre Goiffon
Laurent vilday wrote:
je cherche à savoir comment faire pour détecter sur on click que l'on
a la touche Shift enfoncée ?


<http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html#Events-MouseEvent-shiftKey>

<http://developer.mozilla.org/en/docs/DOM:event.shiftKey>
<http://developer.mozilla.org/en/docs/DOM:event.shiftKey>


Erreur de copié/collé :)

<http://msdn2.microsoft.com/en-us/library/ms534629.aspx>


Tiens je m'aperçois maintenant que dans le MSDN il est indiqué "There is
no public standard that applies to this property", alors que la page sur
DevMo pointe bien vers le W3C... Hu ??



Avatar
SAM

Merci Laurent, je vais regarder ça !


En complément :
http://stephane.moriaux.perso.orange.fr/truc/key_code

Avatar
Pierre Goiffon
SAM wrote:
En complément :
http://stephane.moriaux.perso.orange.fr/truc/key_code


Excellente page, merci de l'adresse !

Avatar
Pierre Goiffon
SAM wrote:
En complément :
http://stephane.moriaux.perso.orange.fr/truc/key_code


Et je découvre au passage que ASM est devenu SAM !

Avatar
Olivier Miakinen

Et je découvre au passage que ASM est devenu SAM !


L'année prochaine ce sera SMA. ;-)

Avatar
SAM
Et je découvre au passage que ASM est devenu SAM !


L'année prochaine ce sera SMA. ;-)


Vous moquez pô ! j'me suis fait voler mon portable.


Avatar
Pierre Goiffon
SAM wrote:
Et je découvre au passage que ASM est devenu SAM !


L'année prochaine ce sera SMA. ;-)


Vous moquez pô ! j'me suis fait voler mon portable.


Gaspe ! Désolé... Espérons que ton voleur agisse comme celui-ci :
http://www.zataz.com/news/15199/voleur-clickfr-photo.html.
Tu es donc revenu sur ton antique Mac précédent ?



1 2