在《C#的百度地图开发(三)依据坐标获取位置、商圈及周边信息》中已经得到坐标的位置信息,有了这些定位信息,那要如何在前端的页面上显示出来呢?这需要用到百度地图的JavaScript的API。下面是示例代码。
前端代码
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ViewMap.aspx.cs" Inherits="TEST.ViewMap" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>地图</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="/js/map.js"></script>
<script src="/js/jquery.js"></script>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=XXXXXXXXXXXX"></script>
</head>
<body>
<div id="normal_map"></div>
<input type="hidden" runat="server" id="HiddenCoord" />
<input type="hidden" runat="server" id="HiddenAddress" />
</body>
&l