رویداد کیبورد altKey
مثال (رویداد کیبورد altKey)
Find out whether or not the "ALT" key was pressed when a keyboard key is pressed:
var x = document.getElementById("demo");
if (event.altKey) {
x.innerHTML = "The ALT key was pressed!";
} else {
x.innerHTML = "The ALT key was NOT pressed!";
}
if (event.altKey) {
x.innerHTML = "The ALT key was pressed!";
} else {
x.innerHTML = "The ALT key was NOT pressed!";
}
خودتان امتحان کنید »
تعریف و کاربرد
The altKey property returns a Boolean value that indicates whether or not the "ALT" key was pressed when a key event was triggered.
Note: On some Mac keyboards, the "ALT" key is displayed as "Option" or "Opt".
Note: This property is read-only.
پشتیبانی مرورگرها
متد | |||||
---|---|---|---|---|---|
altKey | بله | بله | بله | بله | بله |
نحوه استفاده
event.altKey
جزئیات تکنیکی
مقدار برگشتی | A Boolean, indicating whether the "ALT" key was pressed when the key event occured.
Possible values:
|
---|---|
DOM Version: | DOM Level 2 Events |
آموزش های مرتبط
مرجع مدل DOM در اچ تی ام ال KeyboardEvent ctrlKey Property
مرجع مدل DOM در اچ تی ام ال KeyboardEvent metaKey Property
مرجع مدل DOM در اچ تی ام ال KeyboardEvent shiftKey Property
مرجع کلیه رویدادهای JavaScript
- نوشته شده توسط امیر پهلوان صادق
- بازدید: 4025