+ 1

How can I assign multiple functions to window.onload?

https://code.sololearn.com/Wol9qLFCqUW6/?ref=app

21st Dec 2018, 8:28 AM
Samuele Artico
Samuele Artico - avatar
4 Respostas
+ 3
use addEventListener (in this way listeners added will stack automatically) rather than assigning to window.onload ( it will contain whatever was previously assigned to it ): https://code.sololearn.com/WXEOcx0xzy32/#js or you can putt all your code into the same onload method: https://code.sololearn.com/WkhMvMf19Fj4/#js
21st Dec 2018, 9:49 AM
MO ELomari
MO ELomari - avatar
+ 2
put all the function outside the window.onload function then just call all of them in the window.onload function
21st Dec 2018, 9:25 AM
Leon lit
Leon lit - avatar
+ 1
21st Dec 2018, 11:49 AM
Samuele Artico
Samuele Artico - avatar
0
Leon lit but how can I assign all of them to window.onload? Should I separate them with commas?
21st Dec 2018, 9:42 AM
Samuele Artico
Samuele Artico - avatar