można w tym przypadku poprzez pole style elementu:
Kod
if(document.getElementById('alert').style.visibility==='visible'){alert('visible')}
else {alert('hidden')}
lub tak jak odczytuje styl przeglądarka (pole currentStyle nie we wszystkich jest dostępne):
Kod
function getCss(obiekt, wlasnosc) {
if (obiekt.currentStyle) {
return obiekt.currentStyle[wlasnosc];
} else if (window.getComputedStyle) {
return document.defaultView.getComputedStyle(obiekt, null)[wlasnosc];
}
}
if(getCss(document.getElementById('alert'),'visibility')==='visible'){alert('visible')}
else{alert('hidden')}