javascript - Multiple Locations in Bing Maps in an iframe -
i'm trying piece of code work in iframe, error:
referenceerror: getmap not defined
i not advanced programmer, have no idea why works alone, not in iframe (and nobody seems have same problem)! appreciated.
ps: programming code yoyomyo (who posted on stackoverflow), adapted use
<html> <head> <script charset="utf-8" type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0"></script> <script type="text/javascript" language="javascript"> function getmap() { var longitude = new array(); var latitude = new array(); var title = new array(); var description = new array(); longitude[0] = 47.5564154 //two defined locations latitude[0] = 7.59245395 title[0] = "basler münster" description[0] = "basel" longitude[1] = 47.55330556 //second defined location latitude[1] = 7.59001851 title[1] = "theater basel" description[1] = "basel" var total = 2 //number of locations var pininfobox; //the pop info box var infoboxlayer = new microsoft.maps.entitycollection(); var pinlayer = new microsoft.maps.entitycollection(); var apikey = "ampgesj6ovb9ilpwvjyifwm3qmqm5yccyngr_mxmbpw2znyzoxxqaz_kvbc84xcc"; map = new microsoft.maps.map(document.getelementbyid("map"), {credentials: apikey}); // create info box pushpin pininfobox = new microsoft.maps.infobox(new microsoft.maps.location(0, 0), { visible: false }); infoboxlayer.push(pininfobox); (var = 0 ; < total; i++){ //add pushpins var latlon = new microsoft.maps.location(longitude[i], latitude[i]); var pin = new microsoft.maps.pushpin(latlon); pin.title = title[i];//usually title of infobox pin.description = description[i]; //information want display in infobox pinlayer.push(pin); //add pushpin pinlayer microsoft.maps.events.addhandler(pin, 'click', displayinfobox); } map.entities.push(pinlayer); map.entities.push(infoboxlayer); map.setview({zoom: 15, center: new microsoft.maps.location(47.55330556, 7.59001851)}); } function displayinfobox(e) { pininfobox.setoptions({title: e.target.title, description: e.target.description, visible:true, offset: new microsoft.maps.point(0,25)}); pininfobox.setlocation(e.target.getlocation()); } function hideinfobox(e) { pininfobox.setoptions({ visible: false }); } </script> <style> #map { position: relative; top: 0; left: 0; width: 100%; height: 800px; border:none;} </style> </head> <body onload="getmap()"> <div id="some stuff" style="width=100%; height:80px"> text </div> <div id="map" style="width=100%; height:800px"> </div> <div id="some more stuff" style="width=100%; height:80px"> more text read </div> </body> </html>
the code looks fine , i'm unable reproduce error seeing.
Comments
Post a Comment