I would like to dynamically load all layers (KML, for instance) from a user's folder to a group map. This likely requires an iteration that searches the folder and adds the layers to the users' map.

I've been to here and here, but neither of these discuss iterative layers from a given location, nor how to parse n layer names, presumably by Document.getElementById().

Whatever the route taken, list needs to pass to a function I have in a table for creating toggle buttons on each layer. This code works, just curious as to the iteration's effects.

function toggleControl(element){
     if(element.value == "dynamicallyaddedlayer1"){
     if(element.value == "dynamicallyaddedlayer2"){
//...... and so on for as many n layers present

<div id="layerpanel">
    <div data-role="field contain" data-type=“vertical” style="text-align:justify;">
    <fieldset data-role="controlgroup" style="margin-top:0px">  
        <input type="checkbox" name=“dynamiclayer1" value="dynamiclayer1btn" id="dynamiclayer1btn" class=".ui-corner-all" onclick="toggleControl(this);" />
        <label for="dynamiclayer1btn">Name-of-Dynamically-Added-Layer-#1</label>
//... and so on for as many n layers present

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.