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 536k
  • Answers 536k
  • 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 Yes, you should be able to create your own backend.… May 17, 2026 at 1:22 am
  • Editorial Team
    Editorial Team added an answer I filed a bug with Apple, and the reply is:… May 17, 2026 at 1:22 am
  • Editorial Team
    Editorial Team added an answer While you're developing the program the extra +RTS ... shouldn't… May 17, 2026 at 1:22 am

Trending Tags

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

Top Members

Related Questions

In the code HTML+Script below, an event handler is attached after page load using
I have attached the sample code which demonstrates the problem. I am checking this
Hey everyone, take a look at the code below and appreciate how messy the
I have some javascript code that is used in a few different pages in
First, I'm not a javascript developer so I don't have a great deal of
I am trying to setup a fairly simple (imo) Javascript GUI, and am running
I found a JavaScript error in a script that I'm developing. I whittled it
How can I set up my page load event in my code behind to
What object oriented design patterns do you use in your application's javascript, and why?
Is it possible to disable the input textbox at which I attached my datepicker

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.