+
95
-

百度地图js api如何根据关键词来获取经纬度?

请问百度地图js api如何根据关键词来获取经纬度?

网友回复

+
15
-

示例代码

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />

		
    <script type="text/javascript" src="//api.map.baidu.com/api?v=2.0&ak=vxslewBEbWcMz0nolrhZw3piENoYq8r4"></script>
		
		<style type="text/css">
				*{ font-family: "微软雅黑";}
				#where,#lonlat,#lonlat2{ width:300px; height:30px; font-size:24px; color:blue;}
				#but{ width:100px; height:36px; font-size:20px;}
		</style>
		
</head>

<body>
		<center>
		   
		    <form action="" method="post">
			    	<h2>		
				       
				        <h3 style="color: red;">介绍:输入地点然后点击“地图查找”搜索,再点击地图地点获取相应经纬度</h3>
				        <label >输入地点:</label>
				        <input id="where" name="where" type="text" placeholder="请输入地址">
				        <input id="but" type="button" value="地图查找"BfwOnClick="sear(document.getElementById('where').value);" />
				             
								经度:<input id="lonlat" name="lonlat" type="number" maxlength="10">
				              纬度:<input id="lonlat2" name="lonlat2" type="number" maxlength="9">
			    	</h2>
		    </form>
		     <div style=" margin:auto;height:600px; margin-top:50px;" id="container"></div>
		</center>
			




<script type="text/javascript">

		var map = new BMap.Map("container");
		map.setDefaultCursor("cros...

点击查看剩余70%

我知道答案,我要回答