http://developer.yahoo.com/yui/event/#onavailable
YUI allows you to define event handlers for onAvailable, onContentReady and onDOMReady instead of window.onload
These methods will execute before window.onload fires
Also onDOMReady is a safer place for code such as this because it will prevent some bugs from IE6 from happening. Adding DOM nodes while the DOM is still being constructed can cause some obscure bugs in IE.
<script type="text/javascript">
function init() {
//operate document.getElementById('test')
}
YAHOO.util.Event.onDOMReady(init);
// As with addListener, onAvailable, and onContentReady, you can pass a data object and adjust the scope
// YAHOO.util.Event.onDOMReady(init, data, scope);
</script>
<div id="test"></div>