How can I get list ids dynamically, for example ..
<li>
<a href="#">lista1</a>
</li>
<li>
<a href="#" onclick="ocultar;">lista2</a>
</li>
<li>
<a href="#">lista3</a>
</li>
<li>
<a href="#">lista4</a>
</li>
<li>
<a href="#">lista5</a>
</li>
<li>
<a href="#">lista5</a>
</li>
by pressing each list item I am showing iframes with a function so far that you get two id
function ocultar() {
document.getElementById('DivDelista1').style.display = "none";
document.getElementById('DivDelista2').style.display = "block";
};
(the id lists are related to iframe elements) so the detail is that pressing list 2 for example hides the iframe of the lista1
until there everything is fine but when it is in lista5
like hiding the list x
that was in display block
state before?
since in the function I'm assigning ids in a static way,
there is some way of knowing that list is pressed to show it and hide the previous iframe whatever it is selected, I am working with a fairly large number of lists and it is complicated to add a function for each one.