Inserting a checkbox to toggle MapImage display

404
1
05-30-2013 02:04 AM
TheoMorrissey
New Contributor II
Hello,

I have been trying to insert a checkbox that, when checked, displays my MapImage on the basemap. I am using an if/else function to toggle the image display at the .MapImageLayer level. The two methods used are .addImage(MapImage) and .removeImage(MapImage). This does not seem to work and I am trying to understand why (I am new to javascript).

Here is my code:
if(getElementById("chbx").checked=true)
{ 
init.map.mil.addImage(Tile);
}
else
{
init.map.mil.removeImage(Tile);
}


Any help would be greatly appreciated!
0 Kudos
1 Reply
VinayBansal
Occasional Contributor II
Try using setvisibility method on MapImageLayer to toggle the image visibility

http://help.arcgis.com/en/webapi/javascript/arcgis/jsapi/mapimagelayer.html#setvisibility
0 Kudos