altkey鼠標(biāo)事件屬性用于顯示單擊鼠標(biāo)按鈕時是否按下了 SHIFT 鍵。
示例
您可以嘗試運行以下代碼來了解如何在 JavaScript 中實現(xiàn) altKey 鼠標(biāo)事件。
<!DOCTYPE html> <html> <body onmousedown="funcAltKey(event)"> <div>Press and hold ALT key and then click here.</div> <script> function funcAltKey(event) { if (event.altKey) { alert("ALT key: Pressed"); } else { alert("ALT key: NOT Pressed"); } } </script> </body> </html>
登錄后復(fù)制
以上就是altKey Mouse Event在JavaScript中的作用是什么?的詳細內(nèi)容,更多請關(guān)注www.92cms.cn其它相關(guān)文章!