JavaScript-Referenzhandbuch
/ cancelable 事件屬性
cancelable 事件屬性
cancelable 事件屬性
定義和用法
cancelable 事件返回一個布爾值。如果用 preventDefault() 方法可以取消與事件關(guān)聯(lián)的默認(rèn)動作,則為 true,否則為 fasle。
語法
event.cancelable
實例
實例
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script> function myFunction(e){ alert(e.cancelable); } </script> </head> <body> <p onclick="myFunction(event)">單擊這個段落,如果事件是可以取消的將彈出警告框。</p> </body> </html>
運行實例 ?
點擊 "運行實例" 按鈕查看在線實例