On Jun 23, 7:44 am, "[email protected]" <[email protected]>
wrote:
> On Jun 23, 7:29 am, TheDeal56 <[email protected]> wrote:
>
> > Here's a link to my map:http://www.murfreesborotn.gov/map.aspx?ekmenu=316
>
> > I am trying to pass marker info from an XML file, and every XML
> > variable works except for "icontype".
>
> > What am I doing wrong?
>
> function createMarker(point, name,icontype,category, html) {
> markerOptions = { icon: icontype, title: name };
> var marker = new GMarker(point, markerOptions);
>
> the { icon: icontype, ... } requires a GIcon, not a string. When you
> do this:
>
> var icontype = markers[i].getAttribute("icontype");
> var category = markers[i].getAttribute("category");
> var html = markers[i].getAttribute("html");
> // create the marker
> var marker = createMarker(point,tag,icontype,category,html);
>
> You are passing in a string.
One way to address this is with an associative array of icons:
(in the global scope)
var gicons = [];
(after you have created the icons)
gicons["farm"]=farm;
gicons["park"]=park;
gicons["reccenter"]=reccenter;
Then in your createMarker function, do this:
markerOptions = { icon: gicons[icontype], title: name };
-- Larry
(and if you want it to work in IE, read Ralph's post also...)
>
>
>
> > I thought I might try to keep this post short
> > since my map is pretty straight forward, but If I need to provide any
> > additional info, please let me know. Thanks for reading.- 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
-~----------~----~----~----~------~----~------~--~---