Demo

LocationBox JavaScript Demos

Add Label to Marker

Add:     Remove:  

Instructions

Use the "Add" button to add a label to the marker. Use "Remove" button to remove the label. Edit the source code to format the label.
See the JavaScript API for more information.

Source Code

The Javascript code for the above map is:

<script language="Javascript" 
	src="http://www.locationbox.com.tr/locationbox/services?
	Key=key&Cmd=APIV2&Typ=JS"></script>

<script language="JavaScript">
var mapper  = new IMapper();

function startup() {
  mapper.initMap(40.97, 29.065, 10);
  mapper.addNavigationPanel();
  mapper.addMarker('id_1', 40.97, 29.065, 'SampleMarker', 'M.PIN_1', 70, 70, null);
  return;
} 

function add() {    
  var html = "<div style='height:20px; width:150px; 
             background-color:yellow; border: 1px red solid;'>
             Sample Label</div>";
  mapper.addLabelToMarker('id_1', html, null);
  return;
} 

function remove() {
  mapper.removeLabelFromMarker('id_1');
  return;
}

</script>
					

Buttons:


  <a href="javascript:add()"><img src="images/add.gif" border=0></a>
  <a href="javascript:remove()"><img src="images/remove.gif" border=0></a>
 Download working page
Remember that you need to use your key code as Key attribute.