我有不同颜色的折线。我从 mysql db 获取颜色.. 一切正常,但是:mouseout 函数没有返回相同的颜色.. 它只显示行的默认(红色)颜色..
Comp 完成百分比。默认颜色为红色。
我能解释一下吗?
PS对不起我的英语..
function pinfo(poly, html) {
google.maps.event.addListener(poly,"mouseover",function(){ poly.setOptions({
strokeColor:'#FFFFFF', strokeOpacity: .8});});
google.maps.event.addListener(poly,"mouseout",function(){
poly.setOptions({strokeColor:colorr});});
google.maps.event.addListener(poly,'click', function(event) {
mpenc.setContent(html);
mpenc.setPosition(event.latLng);
mpenc.open(map);
});
}
if (comp < 1) {
colorr = '#FA0505' }
if (comp > 0 && comp < 25 ) {
colorr = '#FFA640' }
if (comp > 24 && comp < 50) {
colorr = '#FFFD91' }
if (comp > 49 && comp < 75) {
colorr = '#E8E400' }
if (comp > 74 && comp < 100) {
colorr = '#BFFFAD' }
if (comp == 100) {
colorr = '#0F8500' }
var poly = new g.Polyline({
map:map,
path:pts,
strokeColor:colorr,
strokeWeight:en,
clickable: true,
});
pinfo(poly,html);