asp.net 中引入google 地图

本文展示了一个使用Google地图API创建简单地图应用的例子。通过设定经纬度坐标,可以在网页上显示指定位置的地图,并放置一个标记。该示例还包含了如何设置地图的基本属性如缩放级别和地图类型。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<!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 runat="server">
    <title>无标题页</title>
    <link href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css"
        rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
    <script type="text/javascript"> 
   function initialize() { 
     var myLatlng = new google.maps.LatLng("<%=la%>","<%=lo%>"); 
     var myOptions = { 
        zoom: 16, 
      center: myLatlng, 
   mapTypeId: google.maps.MapTypeId.ROADMAP 
     } 
     var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); 
     var marker = new google.maps.Marker({ 
        position: myLatlng,  
        map: map, 
        title:  "<%=title%>"
     });    
 } 
    </script>
</head>
<body onload="initialize()" style="text-align: center">
    <form id="form1" runat="server">
        <div id="map_canvas" style="width: 70%; height: 340px; margin-top: 2px; margin-bottom: 5px;
            border: solid 1px #ccc; background-color: #F2EFE9; margin: 120px 100px 100px 200px">
        </div>
    </form>
</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值