0
我是初學者在JavaScript現在我在跟蹤應用程序在工作project.now我想改變谷歌地圖標記顏色randomly.here是我的代碼如何隨機設置Google地圖標記顏色?
if(type == 'user')
{
var marker = new google.maps.Marker({
map: map,
icon: 'http://maps.google.com/mapfiles/ms/icons/yellow.png',
position: point,
label: icon.label
});
}
else
{
var marker = new google.maps.Marker({
map: map,
icon: 'http://maps.google.com/mapfiles/ms/icons/green.png',
position: point,
label: icon.label
});
// var pt = new google.maps.LatLng(point);
}
marker.addListener('click', function() {
infoWindow.setContent(infowincontent);
infoWindow.open(map, marker);
});
});
});
}
我得到很多用戶在谷歌地圖相同的顏色。現在我想隨機更改標記顏色。任何人都可以幫助我。
它的工作好了感謝名單@巴拉的阿亞什 –