mhodder
Hi Derek,
Thanks for your reply.
This code illustrates the problem:-
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="http://dev.virtualearth.net/mapcontrol/v4/mapcontrol.js" type="text/javascript"></script>
<style type="text/css">
.ero .ero-body
{
position:relative;
top:-3px;
left:-3px;
width:350px;
overflow:hidden;
border:solid 1px #888;
background-color:#fff
}
</style>
<script type="text/javascript">
// Declare the variable available to whole script
var map = null;
var dummy = null;
var pinID = null;
var locs = new Array;
var originalcolour = null;
var PinsSelected = null;
// this function is called when the page loads
function GetMap()
{
// set up a map and initial type
map = new VEMap('myMap');
map.LoadMap(new VELatLong(53.23234504,-1.54907227),7,'h', false);
// Attach a click event to the map
// map.AttachEvent('onclick', HandleClick);
AddClickablePin(1,-0.459610397815704,51.6549480199814,"","Panel Name 1","A3<br>B2<br>C2<br>D1");
AddClickablePin(2,-0.437193460464478,51.672523868084,"","Panel Name 2","A1<br>B3<br>C3<br>D3");
AddClickablePin(3,-0.508752627372742,51.6899113297462,"","Panel Name 3","A3<br>B2<br>C3<br>D3");
AddClickablePin(4,-0.401508350372314,51.5937400221825,"","Panel Name 4","A2<br>B2<br>C3<br>D1");
AddClickablePin(5,-0.464131588935852,51.6659603238106,"","Panel Name 5","A1<br>B2<br>C2<br>D1");
AddClickablePin(6,-0.474626798629761,51.6390231013298,"","Panel Name 6","A3<br>B2<br>C3<br>D3");
// Get basic Background colour
originalcolour = document.getElementById(6).style.backgroundColor;
// Set background to yelloW initally - IF YOU COMMENT OUT THIS BLOCK YOU WILL SEE THE EFFECT I HAVE WORKING
document.getElementById(1).style.backgroundColor="yellow";
document.getElementById(2).style.backgroundColor="yellow";
document.getElementById(3).style.backgroundColor="yellow";
document.getElementById(4).style.backgroundColor="yellow";
document.getElementById(5).style.backgroundColor="yellow";
document.getElementById(6).style.backgroundColor="yellow";
// now set the view to all the pins
map.SetMapView(locs);
}
// Add a clickable pin
function AddClickablePin(pinID, x,y, icon_url, title, details)
{
var loc = new VELatLong(y,x);
locs.push(loc);
var pin = new VEPushpin(pinID, loc, icon_url, title, details);
map.AddPushpin(pin);
var element = document.getElementById(pinID);
element.onclick = EventHandlerOnClick;
element.title = details;
}
//get the information from the pin
function EventHandlerOnClick(e)
{
if (e!=null)
{
document.getElementById(e.currentTarget.id + "_" + map.GUID).onmouseover();
}
else
{
//alert(window.event.srcElement.id)
if(originalcolour == document.getElementById(window.event.srcElement.id).style.backgroundColor)
{
alert("turning point yellow");
document.getElementById(window.event.srcElement.id).style.backgroundColor="yellow";
}
else
{
alert("point is yellow");
document.getElementById(window.event.srcElement.id).style.backgroundColor=originalcolour;
};
}
}
</script>
</head>
<body onload="GetMap();">
<div id='myMap' style="position:absolute; left:1px; top:1px; width:100%; height:100%;"></div>
</body>
</html>
See if that helps you see the problem