On Feb 5, 11:36 am, pdgguy <[email protected]> wrote:
> Is it possible to just write the function properly so I can
> understand?

//************** Not tested ************************//

function createMarker(point,html)
                {
                        var marker = new GMarker(point, {icon:
icon});
                        // or var marker = new GMarker(point, icon);

                        GEvent.addListener(marker, "click", function
()
                        {
                                marker.openInfoWindowHtml(html);
                        });
                        return marker;
                }

---------------

                var point = new GLatLng(49.2641260,-123.1682350);
                var marker = createMarker(point,'<div>html data here</
div>')
                map.addOverlay(marker);

Please try to understand why it is the way it is...

  -- Larry





>
> On Feb 5, 2:19 pm, "[email protected]" <[email protected]>
> wrote:
>
>
>
> > On Feb 5, 9:04 am, pdgguy <[email protected]> wrote:
>
> > > Thanks - I read it and replied - or thought I did. I don't follow what
> > > is meant.
>
> > This is your createMarker function:
> > function createMarker(point,html)
> >                 {
> >                         var marker = new GMarker(point);
> >                         GEvent.addListener(marker, "click", function()
> >                         {
> >                                 marker.openInfoWindowHtml(html);
> >                         });
> >                         return marker;
> >                 }
>
> > Notice that it makes a GMarker with the default icon and adds the
> > click listener to it.
>
> > This is how you add your markers to the map:
> >                 var point = new GLatLng(49.2641260,-123.1682350);
> >                 var marker = createMarker(point,'<div>html data here</
> > div>')
> >                 map.addOverlay(new GMarker(point, icon));
>
> > Notice that you create a GMarker with your custom icon, and add it to
> > the map, but it is different from the "marker" variable which is
> > returned by the createMarker function.  That one is never added to the
> > map.
>
> >   -- Larry
>
> > > On Feb 5, 11:59 am, "[email protected]" <[email protected]>
> > > wrote:
>
> > > > On Feb 5, 8:40 am, pdgguy <[email protected]> wrote:
>
> > > > > I think I'm running out of variations to try. If I could even find one
> > > > > example that uses a similar format as mine that lists the infowindows
> > > > > individually... this for example uses custom icons but also includes
> > > > > sidebars and xml files.http://econym.org.uk/gmap/basic16.htm
>
> > > > See igloo's post.
>
> > > > > On Feb 5, 11:15 am, pdgguy <[email protected]> wrote:
>
> > > > > > Yes of course:http://www.pdgmedia.com/files/test1.html
>
> > > > > > On Feb 5, 10:46 am, "[email protected]" <[email protected]>
> > > > > > wrote:
>
> > > > > > > On Feb 5, 6:38 am, pdgguy <[email protected]> wrote:
>
> > > > > > > > I've clearly made an error here - the icon shows up fine, but 
> > > > > > > > the
> > > > > > > > window no longer pops up. Can anyone provide assistance?
>
> > > > > > > Can you provide a 
> > > > > > > link?http://groups.google.com/group/Google-Maps-API/web/suggested-posting-...
>
> > > > > > >   -- Larry
>
> > > > > > > > <script type="text/javascript">
> > > > > > > > function initialize()
> > > > > > > > {
> > > > > > > >         if (GBrowserIsCompatible())
> > > > > > > >         {
> > > > > > > >                 function createMarker(point,html)
> > > > > > > >                 {
> > > > > > > >                         var marker = new GMarker(point);
> > > > > > > >                         GEvent.addListener(marker, "click", 
> > > > > > > > function()
> > > > > > > >                         {
> > > > > > > >                                 marker.openInfoWindowHtml(html);
> > > > > > > >                         });
> > > > > > > >                         return marker;
> > > > > > > >                 }
> > > > > > > >                 var map = new GMap2(document.getElementById
> > > > > > > > ("map_canvas"));
> > > > > > > >                 map.setCenter(new 
> > > > > > > > GLatLng(53.958427,-94.513672), 3);
> > > > > > > >                 var mapControl = new GMapTypeControl();
> > > > > > > >                 map.addControl(mapControl);
> > > > > > > >                 map.addControl(new GLargeMapControl());
>
> > > > > > > >                 var icon = new GIcon();
> > > > > > > >                 icon.image = "marker.png";
> > > > > > > >                 icon.shadow = "shadow-marker.png";
> > > > > > > >                 icon.iconSize = new GSize(20.0, 34.0);
> > > > > > > >                 icon.shadowSize = new GSize(38.0, 34.0);
> > > > > > > >                 icon.iconAnchor = new GPoint(10.0, 17.0);
> > > > > > > >                 icon.infoWindowAnchor = new GPoint(10.0, 17.0);
>
> > > > > > > >                 var point = new 
> > > > > > > > GLatLng(49.2641260,-123.1682350);
> > > > > > > >                 var marker = createMarker(point,'<div>html data 
> > > > > > > > here</
> > > > > > > > div>')
> > > > > > > >                 map.addOverlay(new GMarker(point, icon));
>
> > > > > > > >         }}
>
> > > > > > > > </script>- Hide quoted text -
>
> > > > > - Show quoted text -- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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