<div style="line-height:1.7;color:#000000;font-size:14px;font-family:arial"><DIV>Dear all.</DIV>
<DIV>I generated the code as below.</DIV>
<DIV>.Actually,the marker doesn't response to mousedown.</DIV>
<DIV>But it works well if I remove this -------marker.icon = icon</DIV>
<DIV>My question is How to change marker icons?</DIV>
<DIV>&nbsp;</DIV>
<DIV>Thanks in advance.</DIV>
<DIV>&nbsp;</DIV>
<DIV>function addMarker() {</DIV>
<DIV>&nbsp;var layer, markers;</DIV>
<DIV>&nbsp;var currentPopup;</DIV>
<DIV>&nbsp;markers = new OpenLayers.Layer.Markers("Markers");<BR>&nbsp;map.addLayer(markers);<BR>&nbsp;var size = new OpenLayers.Size(20, 20);<BR>&nbsp;var offset = new OpenLayers.Pixel(-(size.w / 2), -size.h);</DIV>
<DIV>&nbsp;var icon = new OpenLayers.Icon('http://www.openlayers.org/dev/img/marker.png', size, offset);<BR>&nbsp;</DIV>
<DIV>&nbsp;AutoSizeFramedCloud = OpenLayers.Class(OpenLayers.Popup.FramedCloud, {<BR>&nbsp;&nbsp;&nbsp;&nbsp;'autoSize' : true</DIV>
<DIV>&nbsp;&nbsp;&nbsp;});<BR>&nbsp;popupClass = AutoSizeFramedCloud;<BR>&nbsp;popupContentHTML = '&lt;img src="<A href="http://www.openlayers.org/dev/img/marker.png&quot;&gt;&lt;/img&gt;'">http://www.openlayers.org/dev/img/marker.png"&gt;&lt;/img&gt;'</A></DIV>
<DIV>&nbsp;var feature = new OpenLayers.Feature(markers, new OpenLayers.LonLat(503810,4307378));<BR>&nbsp;feature.closeBox = true;<BR>&nbsp;feature.popupClass = popupClass;<BR>&nbsp;feature.data.popupContentHTML = popupContentHTML;<BR>&nbsp;feature.data.overflow = (true) ? "auto" : "hidden";</DIV>
<DIV>&nbsp;var marker = feature.createMarker();<BR>&nbsp;marker.icon = icon</DIV>
<DIV>&nbsp;var markerClick = function(evt) {<BR>&nbsp;&nbsp;if (this.popup == null) {<BR>&nbsp;&nbsp;&nbsp;this.popup = this.createPopup(this.closeBox);<BR>&nbsp;&nbsp;&nbsp;map.addPopup(this.popup);<BR>&nbsp;&nbsp;&nbsp;this.popup.show();<BR>&nbsp;&nbsp;} else {<BR>&nbsp;&nbsp;&nbsp;this.popup.toggle();<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;currentPopup = this.popup;<BR>&nbsp;&nbsp;OpenLayers.Event.stop(evt);<BR>&nbsp;};<BR>&nbsp;marker.events.register("mousedown", feature, markerClick);</DIV>
<DIV>&nbsp;markers.addMarker(marker);</DIV>
<DIV>}</DIV></div><br><br><span title="neteasefooter"><span id="netease_mail_footer"></span></span>