javascript - Why doesn't the one that automatically changes the background of the two scripts execute?
天蓬老师
天蓬老师 2017-06-08 11:02:49
0
3
794

Some time ago, I confessed that the webpage was very interesting, so I tried to watch the video and wrote the code, but why was the script for automatically changing the background not executed? Please give me some advice## Only one of the two scripts has been implemented

##
      你是我的最爱--000   

时光不老 我们不散

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all (3)
typecho

Usewindow.addEventListener('load',function(){})to replacewindow.onload = function(){}
Keywords:DOM0 level eventsandDOM2 level events

    刘奇

    The window.onload event is unique in js. No matter how many you write, only one will be executed, and it is the last one, so you can consider using $(function(){}) in jq. It will not appear due to The order of the browser will change the rendering, and the browser will render according to the amount of $(function(){}).

      学习ing

      The window.onload event can only be executed once. If you have already referenced jquery.min.js, you can try changing it to $(function(){}), which can be referenced multiple times.

        Latest Downloads
        More>
        Web Effects
        Website Source Code
        Website Materials
        Front End Template
        About us Disclaimer Sitemap
        php.cn:Public welfare online PHP training,Help PHP learners grow quickly!