国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

SOSO地圖JS畫出標注和中心點以html形式運行

2019-11-20 22:25:40
字體:
來源:轉載
供稿:網友
直接貼出代碼,這個可以在本地創建一個html文件直接運行:
復制代碼 代碼如下:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Map</title>
<script charset="utf-8" src="http://map.soso.com/api/v2/main.js"></script>
<script>
function init() {
var center = new soso.maps.LatLng(31.15953,121.516035);
var map = new soso.maps.Map(
document.getElementById("container"),
{
center: center,//顯示地圖的中心位置
zoom: 15//顯示地圖的縮放級別
}
);

//地圖第一個mark的坐標
var position1 = new soso.maps.LatLng(31.15751,121.514061);

var marker = new soso.maps.Marker({
position: position1,
map: map
});

//地圖第二個mark的坐標
var position2 = new soso.maps.LatLng(31.160705,121.524017);

var marker = new soso.maps.Marker({
position: position2,
map: map
});

}
function loadScript() {
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "http://map.soso.com/api/v2/main.js?callback=init";
document.body.appendChild(script);
}
window.onload = loadScript;
</script>
</head>
<body onload="init()">
<div id="container" style="width:1000px; height:800px"></div>
</body>
</html>
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 平湖市| 临洮县| 明光市| 化州市| 西乌| 印江| 华池县| 长丰县| 资溪县| 辉县市| 丹阳市| 新竹县| 闸北区| 临安市| 静乐县| 禹州市| 开原市| 丁青县| SHOW| 南木林县| 内江市| 田阳县| 临沂市| 务川| 怀柔区| 莒南县| 邻水| 瓮安县| 运城市| 建瓯市| 新邵县| 庆城县| 瑞金市| 扬中市| 喀什市| 民权县| 通海县| 阳春市| 垫江县| 大同市| 杭锦旗|