Ola pessoal...
tenho a seguinte situação:
Preciso de um script onde quando eu clicar no checkbox de uma empresa ... apareça os estabelecimentos ... eu pensei em listar os estabelecimentos em uma div... alguem sabe como eu posso fazer se ao clicar em um checkbox eu mostrar uma div e se eu desmarcar o checkbox volta a sumir a div??
Obrigado pessoal!
Ocultando/ Mostrando Div Por Checkbox
Started By tony, 16/12/2008, 13:07
7 replies to this topic
#1
Posted 16/12/2008, 13:07
#2
Posted 17/12/2008, 09:22
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!
<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.
Especialidade: Desenvolvimento e Banco de Dados.
Este post lhe ajudou? Agradeça:
#3
Posted 17/12/2008, 12:43
Isso mesmo amigo... RESOLVIDO...obrigado pela ajuda
Abs!
Abs!
#4
Posted 05/10/2017, 18:36
Discount Bentyl Kamagra Oral Jelly Gefahrlich Tadalafil 20mg Lowest Price viagra online pharmacy Cialis 28cpr Riv 5mg
#5
Posted 13/10/2017, 04:31
Sildenafil Citrate United States Cheap Levitra Kopen Zonder Recept Uses Of Cephalexin extra super levitra Viagra Rezeptfrei Schweiz
Medicamento Cialis Tadalafil generic levitra for sale Cialis Rezeptfrei Dusseldorf Take Viagra Soft Tabs
Medicamento Cialis Tadalafil generic levitra for sale Cialis Rezeptfrei Dusseldorf Take Viagra Soft Tabs
#6
Posted 30/10/2017, 16:51
Side Effects Of Viagra Tablets online pharmacy Venta Cialis En Espana online accutane forum Buy Zithromax Online Next Day Delivery
#7
Posted 21/11/2017, 15:57
Viagra Vrai Acheter Amoxicillin Use For Canine Ibd buy viagra online Where To Buy Prevacid 30 Mg Non Prescription Paxil On Line
#8
Posted 21/11/2017, 17:32
Zithromax Side Effects Want To Buy Amoxicilina Antibiotic Over Night Tennessee generic cialis Legally Macrobid Discount Cheapeast Albuquerque Il Cialis E Mutuabile
Propecia Colesterol On Line Macrobid Delivered On Saturday Medicine Bentyl Antispas With Free Shipping viagra Reviews On Mylan Bupropion Xl
Propecia Colesterol On Line Macrobid Delivered On Saturday Medicine Bentyl Antispas With Free Shipping viagra Reviews On Mylan Bupropion Xl
1 user(s) are reading this topic
0 membro(s), 1 visitante(s) e 0 membros anônimo(s)