Ai colega... [codebox]
<html>
<head>
<title> Empresas </title>
<script>
function verificaEmpr(emp){
var div = document.getElementById('div'+ emp.id);
if (emp.checked == true)
div.style.display = 'block';
else
div.style.display = 'none';
}
</script>
<style>
.cl_est{
margin-top: 20px;
margin-left: 50px;
display: none;
}
</style>
</head>
<body>
<form id="frm1" name="nm_frm1">
<div>
<input type="checkbox" id="ea" name="nm_ea" onClick="verificaEmpr(this);" />
Empresa A
</div>
<div class="cl_est" id="divea">
<input type="checkbox" id="a1" /> Estabelecimento A1 <br />
<input type="checkbox" id="a2" /> Estabelecimento A2 <br />
<input type="checkbox" id="a3" /> Estabelecimento A3 <br />
<input type="checkbox" id="a4" /> Estabelecimento A4 <br />
</div>
<br />
<div>
<input type="checkbox" id="eb" name="nm_eb" onClick="verificaEmpr(this);" />
Empresa B
</div>
<div class="cl_est" id="diveb">
<input type="checkbox" id="b1" /> Estabelecimento B1 <br />
<input type="checkbox" id="b2" /> Estabelecimento B2 <br />
<input type="checkbox" id="b3" /> Estabelecimento B3 <br />
<input type="checkbox" id="b4" /> Estabelecimento B4 <br />
</div>
<br />
<div>
<input type="checkbox" id="ec" name="nm_ec" onClick="verificaEmpr(this);" />
Empresa C
</div>
<div class="cl_est" id="divec">
<input type="checkbox" id="c1" /> Estabelecimento C1 <br />
<input type="checkbox" id="c2" /> Estabelecimento C2 <br />
<input type="checkbox" id="c3" /> Estabelecimento C3 <br />
<input type="checkbox" id="c4" /> Estabelecimento C4 <br />
</div>
<br />
<div>
<input type="checkbox" id="ed" name="nm_ed" onClick="verificaEmpr(this);"/>
Empresa D
</div>
<div class="cl_est" id="dived">
<input type="checkbox" id="d1" /> Estabelecimento D1 <br />
<input type="checkbox" id="d2" /> Estabelecimento D2 <br />
<input type="checkbox" id="d3" /> Estabelecimento D3 <br />
<input type="checkbox" id="d4" /> Estabelecimento D4 <br />
</div>
</form>
</body>
</html>
[/codebox]
Bom proveito!
Edição feita por: Renan L. Queiroz, 17/12/2008, 09:24.