看起来你的工具提示属性中有html。
看起来代码:var label = points[i].textArray[2];
是造成这个问题。
如果您希望获得提示的HTML标记,则需要将事件添加到标记的mouseover事件中,该事件在元素中显示工具提示,并在mouseout上添加事件以删除提示元素。
您拥有的其他选项是将标签更改为没有HTML标记的东西。
添加使用JavaScript代码提示的下面是一个例子:
其中一些来自How to call fromLatLngToDivPixel in Google Maps API V3?
//You need this to get the projection... put this code at the top of your javascript after you declare map
var overlay = new google.maps.OverlayView();
overlay.draw = function() {};
overlay.setMap(map); //Where map is your Map2 instance
//Put this code at line 164
var label = '';
points[i].marker = new GMarker(points[i],{title: label, icon:tinyIcon(opts.icon)});
google.maps.event.addListener(points[i].marker, 'mouseover', function() {
//Create the tip and get the Point so position the tip
var toolTip = document.createElement('div'),
point = overlay.getProjection().fromLatLngToDivPixel(this.getPosition());
toolTop.styles.position = 'absolute';
toolTop.styles.left = point.x;
toolTop.styles.top = point.y
document.body.appendChild(toolTip);
google.maps.event.addListener(this, 'mouseout', function() {
document.body.removeChild(toolTip);
});
});
来源
2012-05-29 20:14:30
Jay
被带到我要以$ 5或1 BTC的HTML工具提示的例子+您投票:p – Jay
我不是JavaScript的大师,我基本上只是从谷歌的一个例子中复制这段代码,并自定义它来适应我的网站主题。任何帮助一个特定的代码,我可能会添加(以及在哪里广告),将不胜感激。 – DigitalSky
我是StackOverflow的新手......什么是BTC? – DigitalSky