Hello, my JS knowledge is pretty limited. This should be pretty simple...
I am trying to figure out if it is possible to add properties (or tie another variable) to a variable string? I believe it is limited to objects. I'll show you the code to help clarify what I am getting at:
Code:
function toggleKml(theKML) {
if (theKML.toggleState == 1) {
map.removeOverlay(theKML);
theKML.toggleState = 0;
} else {
map.addOverlay(theKML);
theKML.toggleState = 1;
}
}
This function works because theKML is an object. Here is my attempt at the same thing, but passing a string ("tabTitle") instead:
Code:
function toggle_the_tabs(tabTitle) {
if (tabTitle.toggleState == 1) {
tabViewObj.deleteTab(tabTitle);
tabTitle.toggleState = 0;
} else {
tabViewObj.createNewTab('tab_container',tabTitle,'','some.txt');
tabTitle.toggleState = 1;
}
}
And the above function is called by:
Code:
<input type="checkbox" name="tab_toggle" onClick="toggle_the_tabs('A new tab');"/>
<label for="tab_toggle"> Toggle tab</label>
So, my work-around has been to create a dummy object for each item that I toggle. This is not very pretty. Any other suggestions?
Thanks in advance!