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

  • SEARCH
  • Home
  • 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 829555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T03:54:07+00:00 2026-05-15T03:54:07+00:00

The javascript code is attached below. Two push pins are added to a Bing

  • 0

The javascript code is attached below. Two push pins are added to a Bing map. When they are hovered, the description is shown next to the pins. Two buttons are added and ShowInfoBox(shape) is called on the click event. When the buttons are clicked, for some reason, the Infobox always pops up from the center regardless where the pushpins are. Is this a known bug? Can anyone suggest a workaround?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
  <title></title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2"></script>
  <script type="text/javascript">
  var shape;
  var shape1;

 var map = null;
 var infobox = "You can add html codes into the info box or change the style of the info box. You can design and show any info box you want!<br>";

 function ShowInfoBox(sh)
 {
    // The anchor param does not seem to have any effect ???
    map.ShowInfoBox(sh, new VELatLong(sh.Latitude, sh.Longitude), new VEPixel(0, 0));

 }

 function HideInfoBox()
 {
    map.HideInfoBox();
 }


 function GetMap()
 {
    map = new VEMap('myMap');

    map.LoadMap(new VELatLong(47.610377,  -122.200679), 14, VEMapStyle.Road, false, VEMapMode.Mode2D, true);

    shape = new VEShape(VEShapeType.Pushpin, map.GetCenter());


    shape.SetTitle("<h2>Custom Pin0</h2>");
    shape.SetDescription(infobox);

    //Add the shape the the map
    map.AddShape(shape);

    shape1 = new VEShape(VEShapeType.Pushpin, new VELatLong(47.612379,  -122.201677));

    shape1.SetTitle("<h2>Custom Pin1</h2>");
    shape1.SetDescription(infobox);

    //Add the shape the the map
    map.AddShape(shape1);
 }

 </script>
 </head>
 <body onload="GetMap();">
  <div id='myMap' style="position:relative; width:400px; height:400px;"></div>
  <input type="button" value="1" onclick="ShowInfoBox(shape);">
  <input type="button" value="2" onclick="ShowInfoBox(shape1);">
 </body>
</html> 
  • 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-15T03:54:08+00:00Added an answer on May 15, 2026 at 3:54 am

    It isn’t that it won’t set the anchor, it is that the anchor is stuck on whichever lat/long you clicked first. Try zooming between clicks. You’ll see it works.

    What you need to do is throw HideInfoBox() in right before the show.

     function ShowInfoBox(sh)
     {
        // The anchor param does not seem to have any effect ???
        HideInfoBox(); 
        map.ShowInfoBox(shape,new VELatLong(sh.Latitude, sh.Longitude));
    
     }
    

    Just a note: setting your shapes in a global rather than prototyping a GetShapeByTitle() or something will cause you grief if you scale this up. If you can use the VEMap.GetShapeByID(); and the VEShape.GetID(); methods to dynamically retrieve by shape data, it will (in the long run) be easier to deal with.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 437k
  • Answers 437k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer UPDATE 2017: the code below is 7 years old and… May 15, 2026 at 4:10 pm
  • Editorial Team
    Editorial Team added an answer Add the map as a friend class: #include <map> class… May 15, 2026 at 4:10 pm
  • Editorial Team
    Editorial Team added an answer Try setting backgroundImage instead of background-image. CSS attributes, when accessed… May 15, 2026 at 4:10 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.