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

(编辑:jimmy 日期: 2024/10/10 浏览:2)

直接贴出代码,这个可以在本地创建一个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>

一句话新闻

高通与谷歌联手!首款骁龙PC优化Chrome浏览器发布
高通和谷歌日前宣布,推出首次面向搭载骁龙的Windows PC的优化版Chrome浏览器。
在对骁龙X Elite参考设计的初步测试中,全新的Chrome浏览器在Speedometer 2.1基准测试中实现了显著的性能提升。
预计在2024年年中之前,搭载骁龙X Elite计算平台的PC将面世。该浏览器的提前问世,有助于骁龙PC问世就获得满血表现。
谷歌高级副总裁Hiroshi Lockheimer表示,此次与高通的合作将有助于确保Chrome用户在当前ARM兼容的PC上获得最佳的浏览体验。