0

window.onload VS onload in body tag

Can anyone provide a clear explanation about the difference between window.onload and onload in body tag? Thanks in advance.

22nd Jun 2021, 7:09 AM
NBinte
NBinte - avatar
1 Respuesta
+ 2
these are almost same... they target the same property/variable (memory address) the only slightly difference is that body attribute in html tag receive a string, while assigning properties in js (either window.onload or document.body.onload) receive a function ^^
22nd Jun 2021, 7:38 AM
visph
visph - avatar