View Single Post
  #7 (permalink)  
Old Dec 18th, 2006, 11:57
spinal007's Avatar
spinal007 spinal007 is offline
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 23
Posts: 1,650
Blog Entries: 1
Thanks: 0
Thanked 4 Times in 4 Posts
Re: Using Google Maps?

fwxAttachEvent(window, "load", function(){ ... });
...is my own script for attaching window events.

You should just use...
window.onload = function(){ ... };

These....
%72%6F%6E
...are encoded HTML.

The site is run by a CMS and the user might end up putting > < ' " in the text used in the label. I encode it so to avoid runtime errors and undefined strings...

Remember to load the google map script...
<script src="http://maps.google.com/maps?file=api&v=2&key=YOUR_KEY_GOES_HERE&" type="text/javascript"></script>

Then all you need is something like...
window.onload = function(){
var GoogleMap1 = new GMap2(document.getElementById("GoogleMap1"));
GoogleMap1.addControl(new GSmallMapControl());
GoogleMap1.addControl(new GMapTypeControl());
GoogleMap1.setCenter(new GLatLng(51.526, -0.191), 15);
var GoogleMap1point = new GLatLng(51.819247, -2.480292);
var GoogleMap1marker = new GMarker(GoogleMap1point, 1);
GoogleMap1.addOverlay(GoogleMap1marker);
GoogleMap1marker.openInfoWindowHtml("Hello world!");
};

Last edited by spinal007; Dec 18th, 2006 at 12:02.
Reply With Quote