Link to home
Start Free TrialLog in
Avatar of fedkris
fedkris

asked on

div Show-Hide-Div-Layer-Deselect-Checkboxes

hello, i want to create a page with event and seminars, when i deselect seminar, i only want to view all events, but, with these code it doensn't work, only the first div (1) desepears, not all div(1) 's...

can someone help me? thx

<script>
function showMe (it, box) {
  var vis = (box.checked) ? "visible" : "hidden";
  document.getElementById(it).style.visibility = vis;
}
</script>
<div id="div1">
<h3 align="center">this is event 1 </h3>
<table border=1 id="t1">
<tr>
<td>i am here!</td>
</tr>
</table>
</div>

<div id="div2">
<h3 align="center">this is seminar 1</h3>
<table border=1 id="t1">
<tr>
<td>i am here!</td>
</tr>
</table>
</div>


<div id="div1">
<h3 align="center">this is event 2 </h3>
<table border=1 id="t1">
<tr>
<td>i am here!</td>
</tr>
</table>
</div>


<form>
<input type="checkbox" name="c1" onclick="showMe('div1', this)" checked>Event
<input type="checkbox" name="c1" onclick="showMe('div2', this)" checked>Seminaire


</form>

Open in new window

Avatar of Easwaran Paramasivam
Easwaran Paramasivam
Flag of India image

Try below code.

function showMe (it, box) {
  var vis = (box.checked) ? "display" : "none";
  document.getElementById(it).style.display = vis;
}
Avatar of fedkris
fedkris

ASKER

it doensn't work, no good results
Avatar of Tom Beck
I think what @EaswaranP meant was:

Try below code.

function showMe (it, box) {
  var vis = (box.checked) ? "block" : "none";
  document.getElementById(it).style.display = vis;
}
Avatar of fedkris

ASKER

hey, thx for reply, only the first event disepears, not the two events...
ASKER CERTIFIED SOLUTION
Avatar of Tom Beck
Tom Beck
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of fedkris

ASKER

i will look for something else