Thursday 31 August 2006 12:31:22 am
Why not solve a client side problem on the client side ? add this to your included javascript file (if you have one, otherwise put this in your head section)
function $addEvent(el,t,h){
if (el.addEventListener) el.addEventListener(t, h, false);
else if (el.attachEvent) el.attachEvent('on' + t, h);
else { var oldOn = el['on' + t];
if (typeof oldOn != 'function')el['on' + t] = h;
else el['on' + t] = function(){h(); oldOn();};
}
}
Inside your template code, do something like:
$addEvent(document.body,'load',myGoogleMapsStartFunction);
But be aware of the following:
1.body.onload triggers AFTER all images and other content is loaded 2. Ie6 is known to leak memory if you do not realese / remove this event listener on unload To fiks 1. call your function in the bottom of your page instead of the above, something like this will do:
if (myGoogleMapsStartFunction) myGoogleMapsStartFunction();
If this is done instead, you don't have problem 2. any more either.
eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom
|