JSP如何取得所在城市名
比如在杭州打开网页时,在页面的输入框里显示“杭州”,不要省份,如何写?
------解决方案--------------------<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>test</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
</script>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=A63e90def3d0f5488ab9032056429a0d"></script>
<!--加载鼠标绘制工具-->
<script type="text/javascript" src="http://api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.js"></script>
<script type="text/javascript">
//百度地图API功能
var map = new BMap.Map('map');
//获得当前城市
var myCity = new BMap.LocalCity();
myCity.get(myFun);
function myFun(result){
var cityName = result.name;
alert("123");
alert(cityName);
}
</script>
</head>
<body onload="">
</body>
</html>