我使用以下代码创建自定义信息窗口
function format(j,x,q,o,y,g,l,i,n,u){var nn="",uu="",mm=27,m=21,c="Tab2",d="",k="",v="",p="",t="",e="",b="",a="",f="",r,w=6,h=null,s=null;if(u.length==0){c="Tab4"}if(o!=null){if(o.indexOf("?")>0){o=o.substring(1,o.indexOf("?"))}}
y=replaceAll(y,'^','');g=replaceAll(g,'^','');l=replaceAll(l,'^','');y=replaceAll(y,"&","&");g=replaceAll(g,"&","&");l=replaceAll(l,"&","&");y=replaceAll(y,"&","&");g=replaceAll(g,"&","&");l=replaceAll(l,"&","&");y=replaceAll(y,'\\','');g=replaceAll(g,'\\','');l=replaceAll(l,'\\','');
var yyy=replaceAll(y,"'","`");var ggg=replaceAll(g,"'","`");var lll=replaceAll(l,"'","`");y=replaceAll(y,""","\"");g=replaceAll(g,""","\"");l=replaceAll(l,""","\"");
if(y.length>m){v="<a style='cursor:pointer; color:#353535;' onmouseout='UnTip()' onmouseover=\"Tip('<div class="leftBuble"><div class="rightBuble"><div class="midBgBuble">"+yyy+"</div></div></div>')\"><b>"+y.substring(0,(m-4)).toUpperCase()+"...</b></a>";}else{d=y.toUpperCase();v="<b>"+d+"</b>"}
if(g.length>m){e="<a style='cursor:pointer; color:#353535;' onmouseout='UnTip()' onmouseover=\"Tip('<div class="leftBuble"><div class="rightBuble"><div class="midBgBuble">"+ggg+"</div></div></div>')\">"+g.substring(0,(m-4)).toUpperCase()+"...</a>";}else{p=g;e=p}
if(l.length>m){f="<a style='cursor:pointer; color:#353535;' onmouseout='UnTip()' onmouseover=\"Tip('<div class="leftBuble"><div class="rightBuble"><div class="midBgBuble">"+lll+"</div></div></div>')\">"+l.substring(0,(m-4)).toUpperCase()+"...</a>";}else{b=l;f=b}if(ie6){r="margin:-2px 7px 0 0;";w=5}else{if(ie7){r="margin: 2px 11px 0 0;"}else{if(moz||saf||op){r="margin:2px 10px 0 0;"}else{r="margin: 2px 11px 0 0;"}}}
if(u.length!=0){if(u.length>mm){uu="";}else{uu="";}s='<tr><td style="font:normal 10px Arial; color:#353535;padding:0 0 10px 0;" align="left"><table border="0" cellpadding="0" cellspacing="0"><tr><td></td><td style="padding:0 0 0 6px;">'+uu+"</td></tr></table></td></tr>"}else{s="<tr><td></td></tr>"}
if(n.length!=0){if(n.length>mm){nn="<a style='cursor:pointer; color:#353535; text-decoration:none;' href='javascript:void(0);' onclick=\"javascript:"+c+"('Tab3.aspx?locationid="+i+"');UnTip();\" onmouseout='UnTip()' onmouseover=\"Tip('<div class="leftBuble"><div class="rightBuble"><div class="midBgBuble">"+n+"</div></div></div>')\">"+n.substring(0,mm-3)+"...</a>";}else{nn="<a title='"+n+"' href='javascript:void(0)' onclick=\"javascript:"+c+"('Tab3.aspx?locationid="+i+"');\" style='text-decoration:none;'>"+n+"</a>";}h='<tr><td style="font:normal 10px Arial; color:#353535; padding:0 0 2px 0;"><table border="0" cellpadding="0" cellspacing="0"><tr><td><img src="images/arrow.PNG" alt=""/></td><td style="padding:0 0 0 6px;"><a title="'+n+'" href="javascript:void(0)" onclick="javascript:'+c+"('Tab3.aspx?locationid="+i+'\')" style="text-decoration:none;">'+nn+"</a></td></tr></table></td></tr>"}else{h="<tr><td></td></tr>"}return'<div style="width: 202px; height:238px; padding:4px 3px 0 3px; background-image: url(images/map_popwindow.PNG); background-repeat: no-repeat; font:normal 11px/14px Arial; color:#353535;" class="estyle2"><table style="width: 100%" border="0" cellpadding="0" cellspacing="0"><tr><td colspan="5" align="left" valign="top" style="padding:0 0 0 1px;" ><div align="center" id="divPlayer1" name="divPlayer1"><div id="imageName1" name="imageName1"><img src="'+q+'"/></div></div><img src="images/map_closebuttom.PNG" alt="" style="z-index:99; position:absolute; top:1px; right:0px; border:solid 3px #fff; cursor:pointer;'+r+'" onclick="javascript:void closeInfo();" /></td> </tr><tr><td style="width: 21px; height: 30px; padding:3px 0 0 12px;" valign="top"><img src="'+o+'" style="border:none; width: 21px; height: 27px;" alt="" /></td><td style="width: 151px; padding:0 3px 0 9px;"><table style="width: 100%" border="0" cellpadding="0" cellspacing="0"><tr><td style="padding:9px 0 5px 0;">'+v+"</td></tr><tr><td>"+e+'</td></tr><tr><td style="padding:1px 0 6px 0;">'+f+"</td></tr>"+h+s+"</table></td></tr></table></div>"};
和以下代码弹出窗口
function b(k,L,M,K){var J=new GMarker(k,L);GEvent.addListener(J,"click",function(){map.panTo(k);ew.openOnMarker(J,M);});if(K==true){map.addOverlay(J);ew.openOnMarker(J,M)}return J}for(var D=0;D<q;D++){var r=new GIcon(G_DEFAULT_ICON);r.image=baseURL+"images/mme_dealer_marker"+f[D][0]+".png";r.shadow="";r.iconSize=new GSize(29,56);r.iconAnchor=new GPoint(0,58);f[D][9]=replaceAll(f[D][9],"&","&");f[D][9]=replaceAll(f[D][9],""","\"");markerOptions={icon:r,clickable:true,title:f[D][0]+". "+f[D][9]};var v=format(f[D][1],f[D][2],f[D][3],f[D][4],f[D][5],f[D][6],f[D][7],f[D][8],x,H);var B=new GLatLng(f[D][1],f[D][2]);if(D==(p-1)){map.addOverlay(b(B,markerOptions,v,true))}else{map.addOverlay(b(B,markerOptions,v,false))}}}}
可以通过保存以下网址来下载详细的javascript
所有这些在桌面浏览器中工作正常,但关闭按钮在移动浏览器中不起作用。 任何人都可以帮我解决这个问题。
可以使用上述网址
在移动版中测试