<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Google 地图 JavaScript API 示例: 简单地址解析</title>
<script src="http://ditu.google.cn/maps?file=api&v=2.x&key=ABQIAAAAzr2EBOXUKnm_jVnk0OJI7xSosDVG8KKPE1-m51RBrvYughuyMxQ-i1QfUnH94QxWIa6N4U6MouMmBA&hl=zh-CN" type="text/javascript"></script>
<script type="text/javascript"> var map = null;
var geocoder = null; function initialize() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(39.917, 116.397), 13);
geocoder = new GClientGeocoder();
}
} function showAddress(address) {
if (geocoder) {
geocoder.getLatLng(
address,
function(point) {
if (!point) {
alert("不能解析: " + address);
} else {
map.setCenter(point, 13);
var er = new GMarker(point);
map.addOverlay(er);
er.openInfoWindowHtml(address);
}
}
);
}
}
</script>
</head> <body onload="initialize()" onunload="GUnload()">
<form action="#" onsubmit="showAddress(this.address.value); return false">
<p>
<input type="text" size="60" name="address" value="北京市海淀区" />
<input type="submit" value="Go!" />
</p>
<div id="map_canvas" style="width: 500px; height: 300px"></div>
</form>
</body>
</html>他要的是这一种类型的地图,,但是偏偏没有放大缩小按钮,,(其实左键双击放大,右键双击缩小),但是非要加上明显的放大缩小,悲剧了,,我不会弄了怎么弄呢???
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Google 地图 JavaScript API 示例: 简单地址解析</title>
<script src="http://ditu.google.cn/maps?file=api&v=2.x&key=ABQIAAAAzr2EBOXUKnm_jVnk0OJI7xSosDVG8KKPE1-m51RBrvYughuyMxQ-i1QfUnH94QxWIa6N4U6MouMmBA&hl=zh-CN" type="text/javascript"></script>
<script type="text/javascript"> var map = null;
var geocoder = null; function initialize() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(39.917, 116.397), 13);
geocoder = new GClientGeocoder();
}
} function showAddress(address) {
if (geocoder) {
geocoder.getLatLng(
address,
function(point) {
if (!point) {
alert("不能解析: " + address);
} else {
map.setCenter(point, 13);
var er = new GMarker(point);
map.addOverlay(er);
er.openInfoWindowHtml(address);
}
}
);
}
}
</script>
</head> <body onload="initialize()" onunload="GUnload()">
<form action="#" onsubmit="showAddress(this.address.value); return false">
<p>
<input type="text" size="60" name="address" value="北京市海淀区" />
<input type="submit" value="Go!" />
</p>
<div id="map_canvas" style="width: 500px; height: 300px"></div>
</form>
</body>
</html>他要的是这一种类型的地图,,但是偏偏没有放大缩小按钮,,(其实左键双击放大,右键双击缩小),但是非要加上明显的放大缩小,悲剧了,,我不会弄了怎么弄呢???
http://code.google.com/apis/maps/documentation/javascript/v2/controls.html一个简单的例子
http://code.google.com/apis/maps/documentation/javascript/v2/examples/control-simple.html注意你用的是v2版本api,已经不提倡用,这里是v3版本的
http://code.google.com/apis/maps/documentation/javascript/controls.html