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
Use
window.addEventListener('load',function(){})
to replacewindow.onload = function(){}
Keywords:
DOM0 level events
andDOM2 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(){}).
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.