用js+css3如何從前端獲取數據,然后在地圖上顯示某個點的位置現在還只會用js在圖上標出固定點的位置,如何用js獲取一個數據然后標出這點的位置。我找的代碼可以在圖片上某點標記出來但是如何用js把獲取的數據變成標記呢謝謝!<head><title>star</title>?<script type="text/javascript">? ? ?? ? window.onload=function(){? ? ? ? var imgs=[? ? ? ? ? ? ? ? {x:10,y:10,src:"pictures.png"},? ? ? ? ? ? ? ? {x:200,y:10,src:"http://avatar.csdn.net/F/F/E/1_kk3k2005.jpg"}?? ? ? ? ],? ? ? ? map=document.getElementById("map");? ? ? ? for(var t in imgs){? ? ? ? ? ? var img=document.createElement("img");? ? ? ? ? ? img.className="img";? ? ? ? ? ? img.src=imgs[t].src;? ? ? ? ? ? img.style.left=imgs[t].x;? ? ? ? ? ? img.style.top=imgs[t].y;? ? ? ? ? ? map.appendChild(img);? ? ? ? }? ? };?</script><style type="text/css">? ? .map{? ? ? ? width: 500px;? ? ? ? height: 300px;? ? ? ? background: url('http://img.bbs.csdn.net/upload/201505/28/1432804103_373502.jpg') no-repeat;? ? ? ? background-size: 100% 100%;? ? ? ? position: relative;? ? }? ? .img{? ? ? ? position: absolute;? ? }</style></head>?<body>? ??? ?<div class="map" id="map"></div>? ??</body></html>?
用js+css3如何從前端獲取數據,然后在地圖上顯示某個點
阿阿阿阿Agnes
2016-10-23 20:58:34