Just getting back to this now,
Hi Mike, I really appreciate the help!

So I put the function in the header of the parent document.
And addScript(''somejavascript.js'); in the link to the root document?

I assume something like an onclick="addScript('somejavascript.js');"
in the href which loads in the external file?


Thanks Mike!!
Shane



On Aug 7, 11:09 pm, Mike <[email protected]> wrote:
> You'll need to load the API Javascript as a separate file.  A few
> browsers may allow Javascript to be loaded into a div on the fly, but
> most don't.  So you'll need to insert the Javascript as a new Script
> element into your document.
>
> I created a function to do that in my code:
>
> function addScript(url) {
>         var scrpt = document.getElementById(url);
>         if (scrpt == null) {
>                 //If script is not already added, add it
>                 var headID = document.getElementsByTagName("head")[0];
>                 var newScript = document.createElement('script');
>                 newScript.type = 'text/javascript';
>                 newScript.src = url;
>                 newScript.id = newScript.src;
>                 headID.appendChild(newScript);
>         }
>
> }
>
> I call it like this:
> addScript(''somejavascript.js');
>
> (just substitute the actual Javascript you want to load)
>
> That will let you load in javascript files on the fly into your
> header.  My function also tests to see if the script has already been
> loaded into the document, and if so, it won't reload it.
>
> I hope that helps you out.
>
> -Mike Ethetton
> Master Toolworks, LLC
>
> P.S.  If anyone knows somebody looking for a developer/consultant, I'm
> in need of the work right now.  Drop me a line. Thanks!
>
> On Aug 7, 11:15 am, ShaneMcC <[email protected]> wrote:
>
>
>
>
>
>
>
> > Hi Guys,
> > I have a webpage, on which are a bunch of listings, the user clicks a
> > listing and the information loads in a div which has a small map.
>
> > How can I initiate the map when it is loaded in?, I've no experience
> > loading a map via ajax.
>
> > You can have a look at the code 
> > here;http://illustriousworks.ie/files/whosgiggin/whosgiggin.html
>
> > Thanks.
> > Shane

-- 
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