简体   繁体   中英

Polyline Set color option for Google Api V2 getting error ?? C# Web App

i am getting error on the line to set polyline color option my code,

GEvent.addListener(polyline, "click", function() {polyline.setOptions(options: { strokeColor: 'blue' })};

but if i try this,

GEvent.addListener(polyline, "click", function() {alert("clicked");});

it works fine

How to set polyline color on click ??

i also try this,

GEvent.addListener(polyline, "click", function() {PolylineOptions({ strokeStyle: new StrokeStyle({color: 0xFF0000})}); 

it is also resulting in error HOPES for your reply...

It looks like you're mixing up the Maps API V3 and Maps API V2 syntax.

  • Maps API V2 uses setStrokeStyle not setOptions to change Polyline options
  • Maps API V2 uses hex color codes (rather than 'blue' etc)

The following should work.

GEvent.addListener(polyline, "click", function() {
  polyline.setStrokeStyle({ color: "#FF0000" });
};

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM