Answer this question:
function
addMarker(ll, popupClass, html, closeBox, overflow,isShow,mIndex)
{
var feature = new OpenLayers.Feature(markers, ll);
feature.closeBox = closeBox;
feature.popupClass = popupClass;
feature.data.popupContentHTML = html;
feature.data.overflow = (overflow) ? " auto " : " hidden " ;
var marker = feature.createMarker();
marker.setUrl( ' http://www.visitchn.com/main/map/img/marker ' + mIndex + ' .png ' ); // ICON
marker.display( true );
if (isShow == true )
{
removeAllPopup();
feature.popup = feature.createPopup(feature.closeBox);
map.addPopup(feature.popup);
feature.popup.show();
}
var markerClick = function (evt)
{
if ( this .popup == null )
{
this .popup = this .createPopup( this .closeBox);
map.addPopup( this .popup);
this .popup.show();
}
else
{
this .popup.toggle();
}
currentPopup = this .popup;
OpenLayers.Event.stop(evt);
};
marker.events.register( " mousedown " , feature, markerClick);
markers.addMarker(marker);
}
{
var feature = new OpenLayers.Feature(markers, ll);
feature.closeBox = closeBox;
feature.popupClass = popupClass;
feature.data.popupContentHTML = html;
feature.data.overflow = (overflow) ? " auto " : " hidden " ;
var marker = feature.createMarker();
marker.setUrl( ' http://www.visitchn.com/main/map/img/marker ' + mIndex + ' .png ' ); // ICON
marker.display( true );
if (isShow == true )
{
removeAllPopup();
feature.popup = feature.createPopup(feature.closeBox);
map.addPopup(feature.popup);
feature.popup.show();
}
var markerClick = function (evt)
{
if ( this .popup == null )
{
this .popup = this .createPopup( this .closeBox);
map.addPopup( this .popup);
this .popup.show();
}
else
{
this .popup.toggle();
}
currentPopup = this .popup;
OpenLayers.Event.stop(evt);
};
marker.events.register( " mousedown " , feature, markerClick);
markers.addMarker(marker);
}
Code