Check the documentation:
http://code.google.com/apis/maps/documentation/javascript/reference.html#Marker

marker.setIcon(newIcon);
marker.setTitle('foo');

or

marker.setOptions({
  icon: newIcon,
  title: 'foo'
});

or

marker.set('icon', newIcon);
marker.set('title', 'foo');

Chris

On Sat, May 7, 2011 at 9:00 AM, Keith Brown <[email protected]>wrote:

> I'm loading markers via the ajax php/mysql tutorial.  When creating my
> markers in the download xml for loop, I'm assigning some custom variable to
> each marker.  Is it possible to update these custom variables in the marker
> objects?
>
> I've tried something like this:
>
> for (i=0;i<markers.length;i++){
> if (markers[i].myID == thisID){
> var mynewIcon = 'http://www.mydomain.com/newIcon.jpg';
> markers[i].setIcon(mynewIcon);
> markers[i].otherVariable = newValue;
> // I also tried markers[i].setOptions(otherVariable = newValue;
> }
> }
>
> When my code executes, the new icon is displayed but the otherVariable
> value is not updated for that marker.  Does anybody know if it is possible
> to dynamically update a custom variable in a marker object?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Maps JavaScript API v3" 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-js-api-v3?hl=en.
>



-- 
http://twitter.com/broady

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" 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-js-api-v3?hl=en.

Reply via email to