Soso Map JS Draw the callout and center point to run the _javascript technique in HTML form

Source: Internet
Author: User
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>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.