Can anyone tell me why the following is not working please?
Everything works with this apart from the iconType
function createMarker(map, position, number, title, iconType) {
var flag = 'http://code.google.com/apis/maps/documentation/javascript/examples/images/beachflag.png';
var marker = new google.maps.Marker({
position: position,
icon: iconType,
map: map
});
If i set 'icon' directly to the variable 'flag' it works, but when i pull it in from the function variable 'iconType' it 开发者_高级运维does not?
I have tested to make sure that the variable 'flag' is passed to this function.
You can see the whole code here: http://www.oroojo.co.uk/ed/gmaps-2.html
Any ideas?
Because you're setting the icon
property to the string "flag"
, not pointing it to a variable flag
.
精彩评论