Hello everyone,
I hoping you can help me. I've got a table that I want to be able to show/hide rows based on what check box is checked. By default, I don't want anything displayed, then if you check a or some of the check boxes you'll see the data.
Here is what I have, which has some effect in FF but does not work at all in IE.
This is my script (which is part mine, part web-found)
<style type="text/css">
.this {
display: none;
}
.this2 {
display: none;
}
</style>
<script>
function showRow(obj,klassName){
var elems = document.getElementsByName(klassName);
var newDisplay = "none";
if(obj.checked == true){
newDisplay = "block";
}
for(var idx=0; idx < elems.length ; idx++){
elems[idx].style.display = newDisplay;
}
}
</script>
And this is the HTML that I have
The boxes:
Filter Options </br>
<input type='checkbox' id="1" value="yes" onclick="showRow(this,'x')"/>This 1
<input type="checkbox" id="2" onclick="showRow(this,'y')"/>This 2
The rows via PHP (this part does work, it adds the TR classes to the proper rows):
If ($row['Facility'] == "SHEC") {
$trid = "<tr class='this1' name='x'>";
}else{
$trid = "<tr class='this2' name='y'>";
}
If anyone could provide some insight, I would greatly appreciate it.
Thank you!