我用一个for循环 来循环点击 显示弹窗
for (j = 0; j < recordsets[i].features.length; j++) {
feature = recordsets[i].features[j];
x = feature.geometry.x;
y = feature.geometry.y;
size = new SuperMap.Size(18, 18);
icon = new SuperMap.Icon("/ChronicDisease/images/2cf11b3bb909db55bbd6360317fd7f15.gif", size, offset);
LocalMrkerdd = new SuperMap.Marker(new SuperMap.LonLat(x, y), icon);
OutbreakAlertReminder.addMarker(LocalMrkerdd);
OutbreakAlertReminderClick(x,y); //循环显示弹窗
}
function OutbreakAlertReminderClick(x,y) {
contentHTML = "<div style='text-align: center; line-height: 23px !important;'></div></div>";
var size = new SuperMap.Size(0, 33),//标记的大小
offset = new SuperMap.Pixel(0, -size.h),//此类用x,y坐标描绘屏幕坐标(像素点)
icon = new SuperMap.Icon("/ChronicDisease/SuperMap/theme/images/close.gif", size, offset);//图标类,表示显示在屏幕上的图标(弹窗的偏移量)
var popup = new SuperMap.Popup.FramedCloud(
"popwin",//弹窗ID
new SuperMap.LonLat(x, y),//坐标
null,//大小SuperMap.Size
contentHTML,//弹窗内容HTML的字符串表达,其用法同
icon,//锚点
true,//Boolean 是否显示关闭按钮。
function () {
closeInfoWin();
},//关闭弹窗触发该回调函数
false);//是否显示阴影
popup.autoSize = true;//根据弹窗内容自动调整弹窗大小
popup.panMapIfOutOfView = true;//是否移动地图以确保弹窗显示在窗口内
infowin = popup;//赋值
map.addPopup(popup) ;//添加弹窗到map图层-----------报错
}//单击冒泡
代码执行了到 map.addPopup(popup) ; 就报错: VM2150:1 Uncaught TypeError: Cannot read property 'x' of null
怎么解决???