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

Hassan Schroeder hassan.schroeder at gmail.com
Tue Aug 11 14:24:04 CDT 2009


On Tue, Aug 11, 2009 at 2:34 AM, Jono<Jono at charlestonwebsolutions.com> wrote:
> Essentially, yes that is what I am after.  I won't have access to the <head> either, so this will all go inline.  How do I ensure - body onload="initialize()" onunload="GUnload()" - happens using your example?  I see how what you mentioned works, but how do I make that do the onload and onunload that is attached to the body?

You need to spend time with the JQuery doc :-)

> $(document).ready( function() { $("body").bind("onload", initialize()).("onunload", GUnload())});

Actually, this is wrong, in that at the point JQuery defines "ready",
the body's onload event has already passed.

You'll have to decide if there's a functional difference between those
two (pseudo)events in your case, but if not, you could do e.g.

$(document).ready( function() {
  initialize();
  $("body").bind("unload", function(){ GUnload();});
});

Or something like that :-)

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



More information about the thelist mailing list