[thelist] Google Map - onload & onunload without access to <body>

Hassan Schroeder hassan.schroeder at gmail.com
Mon Aug 10 19:39:45 CDT 2009


On Mon, Aug 10, 2009 at 5:02 PM, Jono<Jono at charlestonwebsolutions.com> wrote:
> I need to get the following implemented without having access to the
> <body> tag:

> Mostly, I need a way to do body onload="initialize()"
> onunload="GUnload()" without having access to the body.  This is for a
> CMS that has jQuery support baked in, but there is also a ton of other
> scripts that I need to not interfere with.

So you need to do something like this:

<script type="text/javascript">
$(document).ready( function() { $("body").bind("click", function(){
alert("wtf");})});
</script>

:: where, when the document is loaded in the browser, some function
is bound to an event on the "body" element(s) -- hopefully there's only
one :-) -- to do whatever.

So by putting this in the head of the document, I can then click any
spot in the window after it loads and get a "wtf" alert...

HTH,
-- 
Hassan Schroeder ------------------------ hassan.schroeder at gmail.com
twitter: @hassan



More information about the thelist mailing list