How to add multiple tags to google Maps

Source: Internet
Author: User

JS as follows:

(function() {

???? window. OnLoad = function() {

???????? //Creating an object literal containing the properties

???????? //We want to pass to the map

???????? var options = {

???????????? Zoom:

???????????? Center: New google.maps.LatLng (40.7257, -74.0047),

???????????? MapTypeId:google.maps.MapTypeId.ROADMAP

????????};

???????? //Creating the map

???????? var map = new google.maps.Map (document. getElementById (' map '), options);

???????? //Adding a marker to the map

????????

???????? //For New York, San Francisco, and Seattle

???????????? var places = [];

???????????? //Adding a Latlng object for each city

???????????????? Places.push (new google.maps.LatLng (40.756, -73.986));

???????????????? Places.push (new google.maps.LatLng (37.775, -122.419));

???????????????? Places.push (new google.maps.LatLng (47.620, -122.347));

?

?

???????????? //Looping through the places array

???????????????? for (var i = 0; I < places.length; I+ +) {

???????????????????? //Creating a new marker

???????????????????? var marker = new google.maps.Marker ({

???????????????????????? position: places[i],

???????????????????????? map: map,

???????????????????????? Title: ' Place number '+ i

????????????????????});

????????????????}

????};

})();

CSS as follows:

Body{

font-family< Span style= "COLOR: #38444b" >:verdana ,geneva , arial, helvetica,sans-serif;

Font-size:small;

Background:#fff;

}

#map{

Width:%;

Height:px;

Border:1pxsolid#000;

}

. info{

Width:+px;

}

?

HTML as follows:

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-type" Content="text/html; Charset=utf-8 " />

<title>my first map</title>

<link type= "text/css" href=" Css/style.css " rel= "stylesheet" media=/>

<script Span style= "COLOR: #cb2d01" >type= "Text/javascript" src= "Http://maps.google.com/maps /api/js?sensor=false "></script >

<script type="Text/javascript" src="Js/map.js"></script>

</head>

<body>

<H1>my first map</H1>

<div id="Map"></div>

</body>

</html>

?

The effect is as follows:

How to add multiple tags to google Maps

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.