可以,你需要调整source目录下的script_city.js,在其中添加相应的城市,如果地图上仍然没有显示说明数据库中缺少该城市的坐标,需要你手工添加,我给出的城市数据库只是大部分城市,不排除一些小城市不在其中!
mabest 发表于 2009-4-21 18:13
添加上了
另外楼主里面的说明文本里应该有个问题
step 3:
1). 在template中的default中找到cp_profile.htm,并以编辑方式打开;
2). 找到
<tr>
<th>血型</th>
<td>
<select id="blood" name="blood">
<option value="">保密</option>
$bloodhtml
</select>
</td>
</tr>
在</tr>之后添加
<tr>
<th>家 乡</th>
<td>
<script type="text/javascript" src="source/script_city.js"></script>
<script type="text/javascript">
<!--
showprovince('birthprovince', 'birthcity', '$space[birthprovince]');
showcity('birthcity', '$space[birthcity]', 'birthprovince');
//-->
</script>
</td>
</tr>
<tr>
<th><a name="map" id="map"></a>居住地</th>
<td>
<script type="text/javascript">
<!--
showprovince('resideprovince', 'residecity', '$space[resideprovince]');
showcity('residecity', '$space[residecity]', 'resideprovince');
//-->
</script> <font color="red">* 在选择下面的地图之前,请先选择居住地。</font>
</td>
</tr>
<tr>
<th>地 图</th>
<td><div id="d_map" style="background-color:#FFF;border:solid 1px gray;width:481px;margin-top:3px;">
<div style="width:480px; height:300px;background-color:#f3f3f3;" id="map_canvas"></div>
</div>
<input type="hidden" id="lat" name="lat" value="$space[lat]"/>
<input type="hidden" id="lng" name="lng" value="$space[lng]"/>
<input type="hidden" name="zoom" id="zoom" value="$space[zoom]" />
<input type="hidden" name="sid" id="sid" value="$space[uid]" />
</td>
</tr>
<tr>
<th> </th>
<td><input type="button" id="btn_addMarker" disabled value="标注地图" onclick="AddMarker()" class="button" /> 如果是修改标注,先点击删除标记后重新标注.</td>
</tr>
<tr>
<th>QQ</th>
<td>
<input type="text" class="t_input" name="qq" value="$space[qq]" />
</td>
</tr>
<tr>
<th>MSN</th>
<td>
<input type="text" class="t_input" name="msn" value="$space[msn]" />
</td>
</tr>
<!--{loop $profilefields $value}-->
<tr>
<th>$value[title]<!--{if $value[required]}-->*<!--{/if}--></th>
<td>
$value[formhtml]
<!--{if $value[note]}--> <span class="gray">$value[note]</span><!--{/if}-->
</td>
</tr>
<!--{/loop}-->
<!--{if $_SGLOBAL['guidemode']}-->
</table>
<br>
<table cellspacing="0" cellpadding="0" class="formtable">
<tr>
<td><a href="space.php?do=home&view=guide&step=1">返回</a></td>
<td align="center">
<input type="hidden" name="guidemode" value="1">
<input type="submit" name="profilesubmit" value="下一步" class="submit" />
</td>
<td align="right"><a href="space.php?do=home&view=guide&step=3">跳过>></a></td>
</tr>
<!--{else}-->
<tr>
<th> </th>
<td><input type="submit" name="profilesubmit" value="提交" class="submit" /></td>
</tr>
<!--{/if}-->
</table>
<input type="hidden" name="formhash" value="<!--{eval echo formhash();}-->" />
</form>
<script src=http://ditu.google.com/maps?file=api&v=2&oe=gb2312&key=此处为您申请的googlemapkey type="text/javascript"></script>
<script type="text/javascript">
var myMap;
var myMarker;
var geocoder = null;
window.onload = function() {
if (GBrowserIsCompatible()) {
myMap = new GMap2(document.getElementById("map_canvas"));
var center = new GLatLng(38.079446632654914, 114.48989868164062); //这个地方就是调整默认显示哪里的,至于里面的经纬度已经再上面给处了获取方法。
myMap.addControl(new GLargeMapControl());
myMap.addControl(new GScaleControl());
myMap.enableScrollWheelZoom();
geocoder = new GClientGeocoder();
if (document.getElementById("lat").value == ""){
myMap.setCenter(center, 10); //这个地方就是可以修改到显示多少级别的,如果想显示到街道级别,把11改为16就差不多了,可以自己//改改看
document.getElementById("btn_addMarker").disabled = false;
}
else{
var _lat = document.getElementById("lat").value;
var _lng = document.getElementById("lng").value;
var _zoom = document.getElementById("zoom").value;
var _center = new GLatLng(_lat,_lng);
myMap.setCenter(_center,parseInt(_zoom));
document.getElementById("btn_addMarker").disabled = true;
Mark(_lat,_lng);
}
}
}
// 创建“微型”标记图标
var blueIcon = new GIcon(G_DEFAULT_ICON);
blueIcon.image = "map/images/house.png";
// 设置 GMarkerOptions 对象
markerOptions = { icon:blueIcon };
// 为所有标记创建指定阴影、图标尺寸灯的基础图标
var baseIcon = new GIcon();
blueIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
blueIcon.iconSize = new GSize(32, 32);
blueIcon.shadowSize = new GSize(45, 40);
blueIcon.iconAnchor = new GPoint(20, 30);
blueIcon.infoWindowAnchor = new GPoint(20, 0);
blueIcon.infoShadowAnchor = new GPoint(40.40);
function Mark(lat,lng){
myMarker = new GMarker(new GLatLng(lat,lng), {draggable: true});
GEvent.addListener(myMarker, "click", function() {
myMarker.openInfoWindowHtml("<b>把气球拖动到你要标记的地方</b><p>拖动左边的比例尺可以缩放地图</p><a href='javascript:void(0);' onclick='DeleteMarker()'>删除标记</a>");
});
GEvent.addListener(myMarker, "dragstart", function() {
myMarker.closeInfoWindow();
});
GEvent.addListener(myMarker, "dragend", function() {
var gll = myMarker.getLatLng();
document.getElementById("lat").value = gll.lat();
document.getElementById("lng").value = gll.lng();
document.getElementById("zoom").value = myMap.getZoom();
myMarker.openInfoWindowHtml("<b>把气球拖动到你所在的地方</b><p>拖动左边的比例尺可以缩放地图</p><a href='javascript:void(0);' onclick='DeleteMarker()'>删除标记</a>");
});
myMap.addOverlay(myMarker);
myMarker.openInfoWindowHtml("<b>把气球拖动到你所在的地方</b><p>拖动左边的比例尺可以缩放地图</p><a href='javascript:void(0);' onclick='DeleteMarker()'>删除标记</a>");
}
function AddMarker(){
document.getElementById("btn_addMarker").disabled = true;
var ll = myMap.getCenter();
document.getElementById("lat").value = ll.lat();
document.getElementById("lng").value = ll.lng();
document.getElementById("zoom").value = myMap.getZoom();
Mark(ll.lat(),ll.lng());
}
document.getElementById("residecity").onchange=function AutoMarker(){
var tmpprovince=document.getElementById("resideprovince").value;
var tmpcity=document.getElementById("residecity").value;
var tmpAddress;
tmpAddress=tmpprovince + tmpcity;
if (geocoder) {
geocoder = new GClientGeocoder();
geocoder.getLatLng(
tmpAddress,
function(point) {
if (!point) {
alert("iii,Google居然找不到:" + tmpAddress);
} else {
document.getElementById("btn_addMarker").disabled = true;
myMap.clearOverlays()
Mark(point.y,point.x);
}
}
);
}
}
function DeleteMarker(){
document.getElementById("btn_addMarker").disabled = false;
myMap.removeOverlay(myMarker);
var gll = myMarker.getLatLng();
document.getElementById("lat").value = "";
document.getElementById("lng").value = "";
document.getElementById("zoom").value = "";
}
</script>
<!--{template footerbottom}-->
这一步有多余的代码 修改完后会出现两个家乡 居住地 QQ MSN 还有两个提交 |