myEclipse Repositories自带的googleMap例子,贴出来供学习(转载)

1.map.js
function updateAddress(address) {
geocoder.getLatLng(address, function(location) {
map.setCenter(location, 13);
var marker = new google.maps.Marker(location);
map.addOverlay(marker);
marker.openInfoWindowHtml(getAddressInfo(address));

latField.value = location.lat();
lngField.value = location.lng();
});
}

function getAddressInfo(address) {
return address + "<br><a href=\"http://www.myeclipseide.com\">Powered by MyEclipse IDE</a>";
}

2.google.jsp
<%@ page language="java" contentType="text/html" pageEncoding="UTF-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>MyEclipse Google Maps Example</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">

<script type="text/javascript"
src="http://www.google.com/jsapi?key=ABQIAAAA7rD1jbUY1XVWsL0ov0bKehRP189eykzPrrAV7tRgT92eURxrGxQHDNt6Nc2DQaubssvpI9493dhTGg"></script>
<script type="text/javascript">
google.load("maps", "2");
var map = null;
var geocoder = null;
google.setOnLoadCallback(function initmap() {
map = new google.maps.Map2(document.getElementById("map"));
geocoder = new google.maps.ClientGeocoder();
});
</script>
<script type="text/javascript" src="resources/map.js"></script>
</head>
<body>
<h1>
MyEclipse Google Maps Example
</h1>

<hr>
<table>
<tr>
<td valign="top">
<table>
<tr>
<td valign="top" align="left">
Address:
<br>
</td>
<td />
</tr>
<tr>
<td valign="top" colspan="2">
<form onsubmit="updateAddress(addrField.value); return false">
<input type="text" id="addrField">
<input type="submit" value="Find" />
</form>
</td>
</tr>
<tr>
<td align="right">
Latitude:
</td>
<td>
<input type="text" id="latField" style="width: 95px" />
</td>
</tr>
<tr>
<td align="right">
Longitude:
</td>
<td valign="top">
<input type="text" id="lngField" style="width: 95px">
</td>
</tr>
</table>
</td>
<td>
<div id="map"
style="border: blue 1px solid; width: 640px; height: 4800px">
</div>
</td>
</tr>
</table>
</body>
</html>

From: [url]http://www.javadn.com/read.php?tid-403.html[/url]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值