How can the onLoad event be used in a WordPress template?

When writing PHP templates for WordPress pages we shouldn’t use the <body> tag because it already exists in header.php which is called in the template.
How than can we use the onLoad event within the template?

Since I’m writing more than one template I can’t use it in header.php.

Related posts

Leave a Reply

1 comment

  1. Don’t attach it via the HTML attribute.

    Attach it via an non obtrusive event handler. Because WordPress uses jQuery, that’s as easy as…

    $(window).load(function() {
        // ....
    });