To directly post the code, this can be created in a local HTML file directly run:
Copy Code code as follows:
<! DOCTYPE html>
<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,//shows the central location of the map
zoom:15//shows the zoom level of the map
}
);
The coordinates of the first mark on the map.
var position1 = new Soso.maps.LatLng (31.15751,121.514061);
var marker = new Soso.maps.Marker ({
Position:position1,
Map:map
});
The coordinates of the second mark on the map
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>
<body onload= "init ()" >
<div id= "Container" style= "width:1000px; height:800px "></div>
</body>