how to call javascript on loading a page code example Example: how to call a function as soon as a page loads javascript <body onload="yourFunction()"> </body>