Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5999723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:35:33+00:00 2026-05-23T00:35:33+00:00

i want to place multiple markers on the map but I’m getting a map

  • 0

i want to place multiple markers on the map but I’m getting a map with no markers set.

<script type="text/javascript">

  var map;
  var i;

  window.onload=function()
  {
    var mapOptions = {
      zoom: 13,
      mapTypeId: google.maps.MapTypeId.ROADMAP,
      center: new google.maps.LatLng(59.32522, 18.07002)
    };

    map = new google.maps.Map(document.getElementById("map"),mapOptions);
    var bounds = new google.maps.LatLngBounds();
         var places =[];
         places.push(google.maps.LatLng(40.756,-73.986));
         places.push(google.maps.LatLng(59.32522, 18.07002));
         places.push(google.maps.LatLng(37.775,-122.419));
         places.push(google.maps.LatLng(47.620,-122.347));
         places.push(google.maps.LatLng(-22.933,-43.184));
         for(i=0; i<places.length;i++)
      {
          var marker= new google.maps.Marker({position:places[i],map: map,title:'place Number'+i});

        bounds.extend(places[i]);

      }
      map.fitBounds(bounds);
  }
</script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T00:35:33+00:00Added an answer on May 23, 2026 at 12:35 am

    You need to change all your lines that look like this:

         places.push(google.maps.LatLng(40.756,-73.986));
    

    To look like this:

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

    Here’s your code above with these modifications. It’s working for me. Try it:

    <script type="text/javascript">
    
      var map;
      var i;
    
      window.onload=function()
      {
        var mapOptions = {
          zoom: 13,
          mapTypeId: google.maps.MapTypeId.ROADMAP,
          center: new google.maps.LatLng(59.32522, 18.07002)
        };
    
        map = new google.maps.Map(document.getElementById("map"),mapOptions);
        var bounds = new google.maps.LatLngBounds();
             var places =[];
             places.push(new google.maps.LatLng(40.756,-73.986));
             places.push(new google.maps.LatLng(59.32522, 18.07002));
             places.push(new google.maps.LatLng(37.775,-122.419));
             places.push(new google.maps.LatLng(47.620,-122.347));
             places.push(new google.maps.LatLng(-22.933,-43.184));
             for(i=0; i<places.length;i++)
          {
              var marker= new google.maps.Marker({position:places[i],map: map,title:'place Number'+i});
    
            bounds.extend(places[i]);
    
          }
          map.fitBounds(bounds);
      }
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to place markers on the map. I want to use the standard
I want place ads in my website, but I'm unsure about the common practices
I have multiple column and row data , i want to place it in
To reduce http request i want to mix multiple jquery plugin's javascript filesa and
I have added multiple ovals on map view by using below code but I
I have asked in two earlier questions to place multiple markers from a XML
I have a Django template that I want to extend in multiple places. In
I want to place a Webpart on a page that holds a subfolder of
I want to place this UserControl at Canvas.Left=168, Canvas.Top=213. However, the control appears at
I want to place a table on my page. I have two tables in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.