<script type="text/javascript">
if(window.addEventListener){
window.addhandler= function(who, which, what){
return who.addEventListener(which, what, false);
}
}
else if(window.attachEvent){
window.addhandler= function(who, which, what){
return who.addEventListener('on'+which, what);
}
}
function somefunction(){
alert('page loaded')
}
addhandler(window,'load',somefunction);
</script>