Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialFranklin Rony Cortez Barrera
3,065 Pointswindow.onload its a keyword or a function?
I dont understand why window.onload execute when the web page load.
2 Answers
Zac Mazza
5,867 PointsWould you be able to post the code in question?
window.onload is an event, and is similar to the document.onload event. These events fire the code or method contained within when the entire document loads, including content.
Here's a good example I found on StackOverflow for further reading: https://stackoverflow.com/questions/20180251/when-to-use-window-onload
Zac Mazza
5,867 PointsThanks Jennifer! I'll have to pay closer attention when commenting. :-)
I appreciate the help!
Jennifer Nordell
Treehouse TeacherJennifer Nordell
Treehouse TeacherHi there, Zac Mazza. I took the liberty of changing your comment to an answer. This means that the question will show up as answered on the forums and also make your answer eligible for voting and possible selection of "Best Answer". Thanks for helping out in the Community!