Introduction
Now we use an example by which we get the map style in an Alert Box.
Step 1: For this, first we create a key in Bing maps, which is used as credentials in our program.
- <div id='myfirstMap' style="position:relative; width:500px; height:500px;"></div><div>
Step 3: After that, we take an Input Button and use an onclick event; when we click on it, it shows an alert box for showing the current map style.
- <input type="button" value="My Current Map Style" onclick="getMyMapStyle();" />
Step 4: We write a function ( onload() ) in the <body> tag.
- <body onload="getdatafromMap();">
- <div id='myfirstMap' style="position: relative; width: 500px; height: 500px;">
- </div>
- <div>
- <input type="button" value="My Current Map Style" onclick="getMyMapStyle();" />
- </div>
- </body>
Step 5: Now we write onload() function.
- function getMyMapStyle()
- {
- var x=myfirstmap.getImageryId();
- alert('My Current Map Style: ' + x);
- }
Here we use a Bing map key for credentials.
Step 6: Now we write another function which is called when the button is clicked.



Comments
Join the conversation! Your thoughts help the community grow.