S
Sergio del Amo Caballero
Hi,
I have a structure like this in my xhtml 1.0 file.
<body>
<div>
<a>
<img ... id="f1" />
<span>....</span><br/>
<span>....</span>
</a>
---> <div>
<img />
<span>....</span><br/>
<span>....</span>
</div>
---> <div>
<img />
<span>....</span><br/>
<span>....</span>
</div>
</div>
</body>
I want to acces the div blocks with the arrows from a java script. I use
the javas script object reference elment node. When somebody clicks on
the image with id f1, i want to make invisible the div elements with arrows.
I try to write this:
function make_visible(id_img){
document.getElementById(id_img).parentNode.parentNode.childNodes[2].style.display="none";
document.getElementById(id_img).parentNode.parentNode.childNodes[3].style.display="none";
}
but it does not work.
If i write :
document.getElementById(id_img).parentNode.parentNode.childNodes[1].style.display="none";
after clicking the <a> block gets invisible. The next child will be the
div element. Isn't it?
I do not understand why it does not work, can anybody help me?
I have a structure like this in my xhtml 1.0 file.
<body>
<div>
<a>
<img ... id="f1" />
<span>....</span><br/>
<span>....</span>
</a>
---> <div>
<img />
<span>....</span><br/>
<span>....</span>
</div>
---> <div>
<img />
<span>....</span><br/>
<span>....</span>
</div>
</div>
</body>
I want to acces the div blocks with the arrows from a java script. I use
the javas script object reference elment node. When somebody clicks on
the image with id f1, i want to make invisible the div elements with arrows.
I try to write this:
function make_visible(id_img){
document.getElementById(id_img).parentNode.parentNode.childNodes[2].style.display="none";
document.getElementById(id_img).parentNode.parentNode.childNodes[3].style.display="none";
}
but it does not work.
If i write :
document.getElementById(id_img).parentNode.parentNode.childNodes[1].style.display="none";
after clicking the <a> block gets invisible. The next child will be the
div element. Isn't it?
I do not understand why it does not work, can anybody help me?