展开全部
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Google 地图 JavaScript API 示例: 简单的地图</title>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&language=zh-CN"></script>
<script type="text/javascript">
function initialize() {
var mylatlng = new google.maps.LatLng(39.917, 116.397);
var mapOptions = {
zoom: 14, //缩放级别
center: mylatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP, //ROADMAP-默认视图 SATELLITE-显示Google地球卫星图像 HYBRID-混合显示普通视图和卫星视图 TERRAIN-地形图
scaleControl: true, //比例尺
mapTypeControl: true,
mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU}
};
var map = new google.maps.Map(document.getElementById("map_canvas"),mapOptions);
var mark = new google.maps.Marker({
position : mylatlng,
map : map,
title : "天外居"
});
var message = new google.maps.InfoWindow({
content : "<a href='http://www.baidu.com'><img title='百度一下' src='https://gss0.bdstatic.com/70cFsjip0QIZ8tyhnq/img/iknow/logo-iknowxjd.gif'/></a>",
size : new google.maps.Size(100,100)
});
google.maps.event.addListener(mark,'click',function(){
message.open(map,mark);
});
}
</script>
</head>
<body onload="initialize()">
<form id="form1" runat="server">
<div id="map_canvas" style="width: 400px; height: 200px">
</div>
</form>
</body>
</html>
<head runat="server">
<title>Google 地图 JavaScript API 示例: 简单的地图</title>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&language=zh-CN"></script>
<script type="text/javascript">
function initialize() {
var mylatlng = new google.maps.LatLng(39.917, 116.397);
var mapOptions = {
zoom: 14, //缩放级别
center: mylatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP, //ROADMAP-默认视图 SATELLITE-显示Google地球卫星图像 HYBRID-混合显示普通视图和卫星视图 TERRAIN-地形图
scaleControl: true, //比例尺
mapTypeControl: true,
mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU}
};
var map = new google.maps.Map(document.getElementById("map_canvas"),mapOptions);
var mark = new google.maps.Marker({
position : mylatlng,
map : map,
title : "天外居"
});
var message = new google.maps.InfoWindow({
content : "<a href='http://www.baidu.com'><img title='百度一下' src='https://gss0.bdstatic.com/70cFsjip0QIZ8tyhnq/img/iknow/logo-iknowxjd.gif'/></a>",
size : new google.maps.Size(100,100)
});
google.maps.event.addListener(mark,'click',function(){
message.open(map,mark);
});
}
</script>
</head>
<body onload="initialize()">
<form id="form1" runat="server">
<div id="map_canvas" style="width: 400px; height: 200px">
</div>
</form>
</body>
</html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询