Sys.UI.DomEvent shiftKey Field
Gets a Boolean value that indicates the state of the SHIFT key when the associated event occurred.
var shiftKey = domEventVar.shiftKey;
Return Value
true if the SHIFT key was pressed when the event occurred; otherwise, false.
Remarks
Use the shiftKey field to determine whether the SHIFT key was pressed when the event occurred.
Example
The following example shows how to use the shiftKey field to test the state of the SHIFT key when the associated event occurred.
<script type="text/javascript">
Sys.UI.DomEvent.addHandler($get("Button1"), "click", processEventInfo);
function processEventInfo(eventElement) {
var result = '';
try {
result += "altKey = " + eventElement.altKey + "<br/>";
result += "button = " + eventElement.button + "<br/>";
result += "keyCode = " + eventElement.keyCode + "<br/>";
result += "clientX = " + eventElement.clientX + "<br/>";
result += "clientY = " + eventElement.clientY + "<br/>";
result += "ctrlKey = " + eventElement.ctrlKey + "<br/>";
result += "offsetX = " + eventElement.offsetX + "<br/>";
result += "offsetY = " + eventElement.offsetY + "<br/>";
result += "screenX = " + eventElement.screenX + "<br/>";
result += "screenY = " + eventElement.screenY + "<br/>";
result += "shiftKey = " + eventElement.shiftKey + "<br/>";
result += "target.id = " + eventElement.target.id + "<br/>";
result += "type = " + eventElement.type + "<br/>";
}
catch(e) {
alert("Error:" + e.message);
}
$get('Label2').innerHTML = result;
}
</script>
<script type="text/javascript">
Sys.UI.DomEvent.addHandler($get("Button1"), "click", processEventInfo);
function processEventInfo(eventElement) {
var result = '';
try {
result += "altKey = " + eventElement.altKey + "<br/>";
result += "button = " + eventElement.button + "<br/>";
result += "keyCode = " + eventElement.keyCode + "<br/>";
result += "clientX = " + eventElement.clientX + "<br/>";
result += "clientY = " + eventElement.clientY + "<br/>";
result += "ctrlKey = " + eventElement.ctrlKey + "<br/>";
result += "offsetX = " + eventElement.offsetX + "<br/>";
result += "offsetY = " + eventElement.offsetY + "<br/>";
result += "screenX = " + eventElement.screenX + "<br/>";
result += "screenY = " + eventElement.screenY + "<br/>";
result += "shiftKey = " + eventElement.shiftKey + "<br/>";
result += "target.id = " + eventElement.target.id + "<br/>";
result += "type = " + eventElement.type + "<br/>";
}
catch(e) {
alert("Error:" + e.message);
}
$get('Label2').innerHTML = result;
}
</script>