JavaScript serialization 32 – common mouse events

Time:2021-6-14

1、 Common mouse events

window.onload = function (ev) {
            var logo = document.getElementsByTagName("img")[0];

            //1. New events
            logo.onmouseover = function (e1) {
                console.log("-----");// Mouse into the picture will trigger, also hover over the picture
                this.setAttribute("src","https://www.cnblogs.com/ruigege0000/p/img/img_02.png");
            }
            
            logo.onmouseleave = function (e2) {
                this.setAttribute("src"," https://www.cnblogs.com/ruigege0000/p/img/img_ 05.png");// When the mouse leaves the picture, it will trigger
            }
        }