//F12 切换手机模式
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<title>异步加载地图</title>
<link rel="stylesheet" href="http://cache.amap.com/lbs/static/main1119.css"/>
</head>
<style>
body,html{
font-size: 1rem;
font-family: "微软雅黑";
}
#mapBox{
100%;
height: 35%;
overflow: hidden;
}
#container{
100%;
height: 35%;
background-color: #ccc;
margin-top: 100px;
}
h1{
text-align: center;
}
#count{
padding: 10px;
}
.kilometer{
padding-bottom: 10px;
text-align: center;
border-bottom: 1px solid #ddd;
}
</style>
<body>
<h1>详情</h1>
<p id="time"></p>
<div id="mapBox">
<div id="container"></div>
</div>
<div id="count">
<p class="kilometer">8.129km</p>
<table>
<tr>
<td>17分41秒</td>
<td>0.205cal</td>
<td>17分41秒</td>
</tr>
<tr>
<td>时长</td>
<td>卡路里</td>
<td>配速</td>
</tr>
</table>
</div>
<script src="http://webapi.amap.com/maps?v=1.3&key=0e2641c3d7e299970de643da8564bbf1&callback=init"></script>
<script>
var html = document.getElementsByTagName("html")[0];
var screenW = window.document.documentElement.clientWidth;
html.style.fontSize = (screenW/640)*20 + "px";
function nowDay(){
var oDate = new Date();
var year = oDate.getFullYear();
var month = oDate.getMonth();
var day = oDate.getDate();
var week = oDate.getDay();
var hour = oDate.getHours();
var min = oDate.getMinutes();
var sex = oDate.getSeconds();
switch(week){
case 1:
week = '星期一';
break;
case 2:
week = '星期二';
break;
case 3:
week = '星期三';
break;
case 4:
week = '星期四';
break;
case 5:
week = '星期五';
break;
case 6:
week = '星期六';
break;
case 0:
week = '星期日';
break;
}
function t(t){
if(t<10){
t='0'+t
}
return t;
}
return _html = +year+'/' +month + '/' + day + ' ' + week + '' + t(hour) + ':' + t(min) + ':' +t(sex)
}
var time = document.getElementById("time");
time.innerHTML= nowDay()
var map = new AMap.Map('container', {
resizeEnable: true,
center: [116.397428, 39.90923],
zoom: 13
});
var lineArr = [
[116.368904, 39.913423],
[116.382122, 39.901176],
[116.387271, 39.912501],
[116.398258, 39.904600]
];
var polyline = new AMap.Polyline({
path: lineArr, //设置线覆盖物路径
strokeColor: "#3366FF", //线颜色
strokeOpacity: 1, //线透明度
strokeWeight: 5, //线宽
strokeStyle: "solid", //线样式
strokeDasharray: [10, 5] //补充线样式
});
polyline.setMap(map);
</script>
</body>
</html>