JavaScript Tips & Tutorials

A slightly better approach than <body onload="…">

A tiny little quick tip for javascript beginners.

While you still can execute javascript code upon page loading completion with:

<body onload="jsFunc();">

You can just attach or define an onload event to body in the normal code flow:

window.onload = function() {

By Yang Yang

Hello, I'm Yang. I build online businesses that please people. Want to join in and post some useful articles on Shoot me a message.