<!DOCTYPE HTML><html> <head> <title>onbeforeactivate</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <script> window.onload = function(){ function callback(e) { console.log(e.type) } var a = document.getElementById("test") a.attachEvent('onbeforeactivate', callback); a.attachEvent('onactivate', callback); a.attachEvent('onfocusin', callback); a.attachEvent('onfocus', callback);
a.attachEvent('onmousedown', callback); a.attachEvent('onmouseup', callback); a.attachEvent('onclick', callback); } </script> </head> <body> <input id="test" value="点我"/> </body></html>