+ 2
Why is the ol() function not working here?
4 Respostas
+ 2
Thanks for the reply. They were very helpful.
+ 1
But you change different attributes in each function. So will work:
function ol(){
var a=document.getElementById("a").style.visibility="visible"
}
function cl(){
var a=document.getElementById("a").style.visibility="hidden"
}
And this:
function ol(){
var a=document.getElementById("a") .style.display="block"
}
function cl(){
var a=document.getElementById("a") .style.display="none"
}
0
display and visibility (or opacity with 1 or 0 as value) are two different ways to hide/show an element.
'display: none;' remove element from flow (as it's not part of the page), so space used by it is not preserved.
you should provide a valid 'display' value, or remove the style to show it again...
'visibility:hidden|visible;' toggle 'opacity' of element from 0 to 1, so space used by it is preserved.