网络编程 
首页 > 网络编程 > 浏览文章

SOSO地图JS画出标注和中心点以html形式运行

(编辑:jimmy 日期: 2025/12/27 浏览:3 次 )
直接贴出代码,这个可以在本地创建一个html文件直接运行:
复制代码 代码如下:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Map</title>
<script charset="utf-8" src="/UploadFiles/2021-04-02/main.js"><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>
上一篇:jquery对象和DOM对象的区别介绍
下一篇:javascript判断机器是否联网的2种方法
一句话新闻
微软与英特尔等合作伙伴联合定义“AI PC”:键盘需配有Copilot物理按键
几个月来,英特尔、微软、AMD和其它厂商都在共同推动“AI PC”的想法,朝着更多的AI功能迈进。在近日,英特尔在台北举行的开发者活动中,也宣布了关于AI PC加速计划、新的PC开发者计划和独立硬件供应商计划。
在此次发布会上,英特尔还发布了全新的全新的酷睿Ultra Meteor Lake NUC开发套件,以及联合微软等合作伙伴联合定义“AI PC”的定义标准。
友情链接:杰晶网络 DDR爱好者之家 南强小屋 黑松山资源网 白云城资源网 网站地图 SiteMap