开发者

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

开发者 https://www.devze.com 2023-03-29 11:58 出处:网络
i am getting error on the line to set polyline color option my code, GEvent.addListener(polyline, \"click\", function() {polyline.setOptions(options: { strokeColor: \'blue\' })};

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 ?? 开发者_JS百科

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" });
};
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号