Hello,
I created a function to show a div given its id and hide the other
divs (defined in a div):
function show(id) {
//var e = document.getEle mentsByTagName( "div");
var e = {"home", "contact", "products", "photos"};
for (var i = 0; i < e.length; i++) {
e[i].style.display = 'none';
if (e[i].id == id)
e[i].style.display = 'block';
}
}
This is not working. What am I doing wrong?
It works if I use:
var e = document.getEle mentsByTagName( "div");
But I wan to hide the divs which id's are in the list and show the one
in that list that has the given id.
Thanks,
Miguel
I created a function to show a div given its id and hide the other
divs (defined in a div):
function show(id) {
//var e = document.getEle mentsByTagName( "div");
var e = {"home", "contact", "products", "photos"};
for (var i = 0; i < e.length; i++) {
e[i].style.display = 'none';
if (e[i].id == id)
e[i].style.display = 'block';
}
}
This is not working. What am I doing wrong?
It works if I use:
var e = document.getEle mentsByTagName( "div");
But I wan to hide the divs which id's are in the list and show the one
in that list that has the given id.
Thanks,
Miguel
Comment