js中的文件相对目录,应该以该js所属的网页为准。
如下:
网页在 logic 下,但是图片在js/OpenLayersV2.10/theme/default/img下
tagMap = new OpenLayers.Layer.Vector("Tag Layer",
{
styleMap: new OpenLayers.StyleMap({
// Set the external graphic and background graphic images.
externalGraphic: "../js/OpenLayersV2.10/theme/default/img/marker.png",
backgroundGraphic: "../js/OpenLayersV2.10/theme/default/img/marker_shadow.png",
// Makes sure the background graphic is placed correctly relative
// to the external graphic.
backgroundXOffset: 0,
backgroundYOffset: -7,
// Set the z-indexes of both graphics to make sure the background
// graphics stay in the background (shadows on top of markers looks
// odd; let's not do that).
graphicZIndex: MARKER_Z_INDEX,
backgroundGraphicZIndex: SHADOW_Z_INDEX,
pointRadius: 10
}),
rendererOptions: { yOrdering: true }
}
);