In your template (manage resources/templates).
You will probably find something like
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
.
.
</head>
<body>
.
.
</body>
</html>
Just put a
<script type="text/javascript" src="assets/templates/yourtemplate/scripts/yourjavascript.js"></script>
in between the <head></head> (obviously with your own pathname)
and add your ’onload’ to the body tag.
If you don’t want this for every page you will have to make a duplicate of your template and use that in the places you want your script.