On Jan 17, 1:20 pm, Tintin81 <[email protected]> wrote:
>
> How can I include a simple GoogleMap on my website without using this
> statement in my HTML:
>
> <body onload="load()" onunload="GUnload()">
>
> My content management system can't handle it and I would like to put
> it into an external .js file. How can I do that?

There's a relevant discussion in this thread:
http://groups.google.com/group/Google-Maps-API/browse_thread/thread/6c280fec36d50ebf#

In your external file, you can have
  function load(){ ... }
  window.onload=load;
  window.onunload=GUnload;
but you must make sure that the window.onload line comes after
function load() is defined; and you must make sure that the
window.onunload line comes after function GUnload() is defined. For
that to be the case, put your external file's <script> tag after the
<script> tag that loads the API.

Instead of an external js file, you could put all your Javascript at
the bottom of your page, just before </body>. The CMS can probably
cope with that. The browser will execute the script when it reaches
it, having loaded and rendered the rest of the page. That way you
don't need window.onload. You do need to make sure that every element
in the page is correctly closed, so even <p> elements will need </p>.

Give it a go and come back with a link if you have problems.

Andrew
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to