Newbie GMarker problem
Hello,
as a newbie in javascript and the google map api I need some little
help.
I'm using custom markers as I would like to apply different icons.
// Create base marker icon
var baseIcon = new GIcon();
baseIcon.shadow =
"http://www.tidakapapa.com/images/diveflag_shadow.png";
baseIcon.iconSize = new GSize(18, 30);
baseIcon.shadowSize = new GSize(33, 30);
baseIcon.iconAnchor = new GPoint(9, 30);
baseIcon.infoWindowAnchor = new GPoint(5, 1);
// Create divesite icons
var divesiteIcon = new GIcon(baseIcon);
divesiteIcon.image =
"http://www.tidakapapa.com/images/diveflag.png";
var anchorbigIcon = new GIcon(baseIcon);
anchorbigIcon.image =
"http://www.tidakapapa.com/images/anchorbig.png";
var anchorsmallIcon = new GIcon(baseIcon);
anchorsmallIcon.image =
"http://www.tidakapapa.com/images/anchorsmall.png";
well everything works fine if I put the name of the variable.
var marker = new GMarker(point, divesiteIcon);
But why can I not replace "divesiteIcon" with the variable "icon" which
is read from my data.xml file.
var icon = markers[i].getAttribute("icon");
Many thanks for any hints.
:-) Dirk
0 Comments:
Yorum Gönder
<< Home