AI OnAI Off
If you use jquery you can do like
$('body').ready(function() {
// do something funny
});
If not you can try to just use
window.onload = function() {
// Do something
}
The jquery option is a good solution, thanks. With the following for the unload event.
$(window).unload(function() { unload(); });
I have a control to be added to one page of a site that requires the body tag to have onload and onunload events adding. I would prefer not to have a second copy of the master template just to allow these attributes to be added to the body tag, and all of the examples I have found for referencing the master page's body require runat="server" and an ID to be added to the master template, doing this stops the page displaying in EPiServer.
Is there a way of conditionally adding onload and onunload to the body tag, so it would look like the example below?
<body onload="load()" onunload="unload()">