Notice: Undefined variable: root in /users/basti1012/www/index1.php on line 41
Detect all Events

Detect all Events

Ermittle welche Events gerade alle gefeuert werden

Der hier verwendete Code

<style> body{ width:100vw; height:100vh; border:10px solid black; } .main{ width:90%; height:200px; border:3px solid red; margin:0 auto; } </style> <body> <table> <tr><th>Eventtype</th> <th>timeStamp</th> </tr> <tbody> </tbody> <h2>Event Feld zum testen</h2> <textarea class="main"></textarea> <textarea> </textarea> <script> var all_events=['abort','afterprint','animationend','animationiteration','animationstart','beforeprint','beforeunload','blur','canplay','canplaythrough','change','click','contextmenu','copy','cut','dblclick','drag','dragend','dragenter','dragleave','dragover','dragstart','drop','durationchange','ended','error','focus','focusin','focusout','fullscreenchange','fullscreenerror','hashchange','input','invalid','keydown','keypress','keyup','load','loadeddata','loadedmetadata','loadstart','message','mousedown','mouseenter','mouseleave','mousemove','mouseover','mouseout','mouseup','offline','online','open','pagehide','pageshow','paste','pause','play','playing','progress','ratechange','resize','reset','scroll','search','seeked','seeking','select','show','stalled','submit','suspend','timeupdate','toggle','touchcancel','touchend','touchmove','touchstart','transitionend','unload','volumechange','waiting','wheel','requestPermission','deviceorientation','devicemotion','unload','popstate','auxclick','mousewheel','ratechange','durationchange','emptied','stalled','loadedmetadata','loadeddata','getCurrentPosition','watchPosition','zoom','messageerror','readystatechange','loadend','timeout','pointerover','pointerout','pointerenter','pointerleave','pointerdown','pointerup','pointermove','pointercancel','gotpointercapture','lostpointercapture','pointerrawupdate','beforecopy','beforecut','beforepaste','enterpictureinpicture','leavepictureinpicture','DOMActivate','DOMFocusIn','DOMFocusOut','DOMAttrModified','DOMCharacterDataModified','DOMNodeInserted','DOMNodeInsertedIntoDocument','DOMNodeRemoved','DOMNodeRemovedFromDocument','DOMSubtreeModified','DOMContentLoaded']; ele=document.getElementsByClassName('main')[0]; ele1=document.getElementsByTagName('textarea')[1]; for(a=0;a<all_events.length;a++){ ele.addEventListener(all_events[a],function(e){ console.log(e['type']); ele1.value+=`${e['type']} , `; }) } </script> </body>