I've got a page within wordpress that I wish to password safeguard using a user role wordpress plugin. Everything works fine on easy pages but I've got a page with window.onload = function() { that completely overrides the password function.

I would like the page to load soon after it's checked to ascertain if the consumer is drenched in or otherwise.

Update:

I am using this plugin and that i simply have the function:

<script type="text/javascript"> 
(function() { 

window.onload = function() { 
 var map = new google.maps.Map(document.getElementById('map'), options);
...
} } )
</script>

Which in turn loads about this div:

<div id="map" style="width:100%; height:100%"></div>

Rather than setting it straight to the onload property add it as being a celebration listener

https://developer.mozilla.org/en/DOM/element.addEventListener

You will need to use attachEvent for IE versions < 9.

http://msdn.microsoft.com/en-us/library/ms536343(v=vs.85).aspx

If you are utilizing a framework for example jQuery or Prototype this is often abstracted out so you don't have to be worried about different browsers.

Make use of addEventListener or attachEvent to load multiple functions. If you wish to use window.onload = .., make use of the code within the last else block in the function below:

function addEvent(name, func) {
    if (window.addEventListener) {
        window.addEventListener(name, func, true);
    } else if(window.attachEvent) {
        window.attachEvent('on' + name, func);
    } else {
        var other_func = typeof window['on'+name] == "function" ? window['on'+name] : function(){};
        window['on' + name] = function(ev){
            func(ev);
            other_func(ev);
        }
    }
}

addEvent('load', function(){
   //Load function 
});