开发者

Make elements "known" to functions in JavaScript before assignment

开发者 https://www.devze.com 2023-03-13 10:51 出处:网络
I am writing a page using JavaScript, and I have 4 divs, all of which are from the same class. Each div has a function that changes the styles of the other divs (border colour and background colour, f

I am writing a page using JavaScript, and I have 4 divs, all of which are from the same class. Each div has a function that changes the styles of the other divs (border colour and background colour, for example). The problem is t开发者_StackOverflowhat the last div does not get affected by the functions of the divs above it, because it was not "assigned" yet. Is there any way to fix this?


window.onload = function() {

};

Make sure you run your code when the window has completely loaded.

0

精彩评论

暂无评论...
验证码 换一张
取 消