S
shapper
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.getElementsByTagName("div");
var e = {"home", "contact", "products", "photos"};
for (var i = 0; i < e.length; i++) {
e.style.display = 'none';
if (e.id == id)
e.style.display = 'block';
}
}
This is not working. What am I doing wrong?
It works if I use:
var e = document.getElementsByTagName("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.getElementsByTagName("div");
var e = {"home", "contact", "products", "photos"};
for (var i = 0; i < e.length; i++) {
e.style.display = 'none';
if (e.id == id)
e.style.display = 'block';
}
}
This is not working. What am I doing wrong?
It works if I use:
var e = document.getElementsByTagName("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