原帖由 acbs 于 2007-1-11 14:02 发表
老兄,你那个地图是怎以实现的,能交个朋友吗
他的地图是一个PHP文件!如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>无标题文档</title>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style></head>
<body >
<script language="javascript" src="http://api.51ditu.com/js/maps.js"></script>
<div id="myMap" style="position:relative; width:420px; height:405px; border:none;"></div>
<script>
var shops=new Array(
new Array("11261717","2690811", "ONLY YOU", "../webdata/biz_images/2007/01/10/2939674e04c4427f43d34d52db8aa624_s.jpg", "13566668888", "潮流特区"),new Array("11260630","2690596", "花语花艺", "../webdata/biz_images/2007/01/10/5ae3ce2c08ee7a1fbafebdbe067a3d5b_s.jpg", "0734-8269934", "衡阳市中山南路1号"),new Array("11261529","2691287", "光大国旅雁峰营业部", "../webdata/biz_images/2007/01/10/d9820eec8563dd9974ed49d1dc1a04f7_s.jpg", "0734-8153033", "市蒸阳南路德园小区102号门面"),new Array("11261263","2690181", "丽华彩扩部", "../webdata/biz_images/2007/01/10/b7dec0bf41a3c7bae20a8d866984d48c_s.jpg", "", "衡阳市解放路(南方大厦旁)"));
var maps = new LTMaps('myMap');
maps.cityNameAndZoom( "hengyang" , 3 );
maps.addControl(new LTSmallMapControl());
var loadHotShops = [];
for(var i=0; i<shops.length; i++){
createMark(shops, i);
}
function createMark(shop, index){
var point = new LTPoint(shop[0], shop[1]);
if(index == 0){
//hMap.moveToCenter(point);
}
var mapnum = index+1;
var marker = new LTMarker(point);
marker.setIconImage('../images/map/'+ mapnum+'.gif');
maps.addOverLay(marker);
text = new LTMapText( marker );
text.setLabel( shop[2] );
maps.addOverLay( text );
loadHotShops[index] = marker;
marker.infoWinHtml = '<div><img src="'+shop[3]+'" width="70" height="45"></div><div>'+shop[2]+'</div><div>电话:'+shop[4]+'</div><div>地址:'+shop[5]+'</div>';
LTEvent.addListener( marker , "mouseover" , function(){ openMarkInfo(index)});
LTEvent.addListener( marker , "mouseout" , function(){ closeMarkInfo(index)});
return marker;
}
function openMarkInfo(markIndex){
var mark = loadHotShops[markIndex]
if(mark != null){
// parent.closeAllClass();
mark.openInfoWinHtml(mark.infoWinHtml);
mark.setInfoWinWidth(150);
mark.setInfoWinHeight(50);
// parent.changeClass(markIndex, 'current');
}
}
function closeMarkInfo(markIndex){
var mark = loadHotShops[markIndex]
if(mark != null){
//parent.closeAllClass();
mark.openInfoWinHtml("").closeInfoWindow();
// parent.changeClass(markIndex, 'no');
}
}
function findShop(index) {
var t = parseInt(shops[index][1]) + 250;
myPoint=new LTPoint(shops[index][0], t)
maps.moveToCenter(myPoint,1);
var mark = loadHotShops[index]
mark.openInfoWinHtml(mark.infoWinHtml);
mark.setInfoWinWidth(150);
mark.setInfoWinHeight(50);
}
</script>
</body></html> |