Galera, tô com uma dúvida sobre como eu escondo e mostro o conteúdo de todas as DIVs num clique de um botão. Eu tô fazendo assim
<head>
<script language="javascript">
function hideAll(){
var clas = document.getElementsByTagName("div");
if(clas.className == "algo"){
clas.style.display = "none";
}
</script>
</head>
<body>
<c:if test="${!empty showOccurrence}">
<p align = "center">
<b><c:out value="${showOccurrence}" > </c:out></b>
<input type="button" value="Expandir" id="expand" onclick="showAll()"/>
<input type="button" value="Contrair" id="contract" onclick="hideAll()"/>
<input type="button" value="Gerar PDF" id="generatePdf" onclick=""/>
</p>
<br />
<c:forEach var="currrentEquipment" items="${list}">
<a href="javascript:showHide('${currrentEquipment.name}')"> <c:out value="${currrentEquipment.sectionTitle}"></c:out> </a>
<div class="algo" id='${currrentEquipment.name}' style="display: none;">
<br />
<c:out value='${currrentEquipment.information}' /> <br />
</div>
<br />
</c:forEach>
</c:if>
</body>
Mas não funciona, não faz nada... e aí? Alguma dica?