您好,
1.mousemove事件代表的是鼠标在地图移动的时候就会触发,如果您想要实现鼠标放在marker上显示话请监听mouseover事件。
2.在您遍历输出marker的之前就应该遍历一下您的要传入的数组,您可以参考以下代码:
function processCompleted(queryEventArgs){
var result = queryEventArgs.result;
if (result && result.totalCount>0) {
var resultTable="";
for (var i =0;i<result.recordsets.length;i++) {
if (result.recordsets[i].features) {
var arrFields = new Array();
var intFieldCount=result.recordsets[i].fields.length;
resultTable +="<table id='datatable' align='left' style='position:relative;width:300px;height:300px;overflow-y:auto;' border='1'>";
var strTableHead="";
for(var n=0;n<intFieldCount;n++)
{ var fieldName=result.recordsets[i].fields[n];
strTableHead +="<td>";
strTableHead +=fieldName;
arrFields.push(fieldName);
}
strTableHead +="<td>";
strTableHead +="<input type='submit' value='refresh' >";
resultTable +="<tr>"+strTableHead+"</tr>";
for(var k=0;k<result.recordsets[i].features.length;k++)
{ var point = result.recordsets[i].features[k].geometry,
size = new SuperMap.Size(22, 20),
offset = new SuperMap.Pixel(-(size.w / 2), -size.h),
icon2 = new SuperMap.Icon("../theme/images/marker-gold.png", size, offset);
var feature=new SuperMap.Feature.Vector();
feature=result.recordsets[i].features[k];
var marker=new SuperMap.Marker(new SuperMap.LonLat(point.x, point.y), icon2);
marker.chao=feature;
markerLayerSQL.addMarker(marker);
marker.events.on({//注册点击事件的处理方法
"mouseover":openInfoWin,
"mouseout": setTimeout111,
"scope": marker
});
resultTable += "<tr>";
for(var j=0;j<intFieldCount;j++){
resultTable +="<td>";
resultTable += feature.attributes[arrFields[j]];
if (j%2==1){
resultTable +="<td>";
resultTable +="<input type='checkbox' >";
}
resultTable +="</td>";
}
resultTable +="</tr>";
}
}
}
}
else{ resultTable="<p>无查询结果</p>";}
document.getElementById("queryResultPanel").innerHTML=resultTable;
}
var infowin = null;
function openInfoWin() {
closeInfoWin()
//关闭之前打开的窗口。
var marker = this;
var lonlat = marker.lonlat;
var rainObj=marker.chao;
var contentHTML = "<div style='font-size:.8em; opacity: 0.8; overflow-y:hidden;'>";
contentHTML += "<div>"+rainObj.attributes.name+ "</div>"
var size = new SuperMap.Size(0, 33);
var offset = new SuperMap.Pixel(0, -size.h);
var icon2 = new SuperMap.Icon("../theme/images/marker-gold.png", size, offset);
var popup = new SuperMap.Popup.FramedCloud("popwin",
new SuperMap.LonLat(lonlat.lon,lonlat.lat),
null,
contentHTML,
icon2,
false);
infowin = popup;
map.addPopup(popup);
}