求解,为何我这个小东西,没有办法把地图展示出来。
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
body, html,#allmap {width: 100%;height: 100%;overflow: hidden;margin:0;}
</style>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=1q1ZHq9D8u5x0N45xURs8Wmg"></script>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css">
<script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>
<script type="text/javascript">
if (navigator.geolocation) {
alert( ' 你的浏览器支持 geolocation ' );
}else{
alert( ' 你的浏览器不支持 geolocation ' ) ;
}
navigator.geolocation.getCurrentPosition(getPosition);
function getPosition(position){
var latitude = position.coords.latitude;
var longitude = position.coords.longitude;
var point = new BMap.Point(longitude,latitude);
var map = new BMap.Map("allmap"); // 创建地图实例
map.centerAndZoom(point, 15);
var marker = new BMap.Marker(point); // 创建标注
map.addOverlay(marker);
}
</script>
<title>无</title>
</head>
<body>
<div data-role="page" id="a1">
<div data-role="navbar">
<ul>
<li><a href="#" class="ui-btn-active">地图</a></li>
<li><a href="#a2">周边</a> </li>
</ul>
</div>
<div data-role="content">
<form >
<table align="center">
<tr>
<td><input type="text" ></td>
<td><input type="button" value="搜索"></td>
</tr>
</table>
</form>
<div id="allmap" style="margin:30% o o o"></div>
</div>
</