Thanks for the reply Jennifer - fortunately, I figured it out! var map;
var oysterLayers;
function init() {
var extent = new esri.geometry.Extent({"xmin":409914.00497589994,"ymin":104607.44204058842,"xmax":482562.42004832183,"ymax":141217.9675552771,"spatialReference":{"wkid":26985}})
map = new esri.Map("map",{extent:extent});
var baseMap = new esri.layers.ArcGISTiledMapServiceLayer("http://www.mdimap.us/ArcGIS/rest/services/ImageryBaseMapsEarthCover/MD.State.MDiMap_Gazetteer83M/MapServer");
map.addLayer(baseMap);
oysterLayers = new esri.layers.FeatureLayer("http://www.mdimap.us/ArcGIS/rest/services/Biota/MD.State.BayOysters/MapServer/0");
}
function toggle(form) {
if (form.checkThis.checked) {
map.addLayer(oysterLayers)
} else {
map.removeLayer(oysterLayers)
}
}
The layer I was trying to toggle with a checkbox was the one defined by the oysterLayers variable. I had originally defined that variable under the toggle function; for some reason when doing that, I could add the layer via the checkbox, but not remove it. Any idea why that's the case? I'm still quite new to JavaScript so I'm not able to see why that wouldn't work.