In the modern event processing method of JS, how to deal with compatibility for older versions of browsers? -PHP Chinese website Q&A-In the modern event processing method of JS, how to deal with compatibility for old versions of browsers? -PHP Chinese website Q&A
In the modern event processing method of JS, how to deal with compatibility for older versions of browsers? -PHP Chinese website Q&A-In the modern event processing method of JS, how to deal with compatibility for old versions of browsers? -PHP Chinese website Q&A
Please watch and learn.
If(document.addEventListener){
[object].addEventListener(“事件名称”,函数名,true/false) //DOM
}else if(document.attachEvent){
[object].aattachEvent(“事件名称”,函数名,true/false) // IE
}