ampera
01-10-2010, 05:47 PM
why this script not work to internet explorer...
<script type="text/javascript">
function hide_checkbox(){
findTr = function(el) {
while (el.parentNode) {
el = el.parentNode;
if (el.tagName.toLowerCase() == 'tr')
return el;
}
}
form = document.getElementById("form");
var check = form.elements;
for(var i = check.length - 1; i > -1 ; --i){
if(check[i].type == 'checkbox' && check[i].checked){
var checkedCheckbox = findTr(check[i])
if(checkedCheckbox){
checkedCheckbox.style.display = 'none';
}
}
}
}
</script>
<form id="form" action="" >
<table width="400" border="1">
<tr>
<td width="364"> 1. Hide......</td>
<td width="20"><input type="checkbox" name="name" value="value1"></td>
</tr>
<tr>
<td width="364"> 2. Hide......</td>
<td width="20"><input type="checkbox" name="name" value="value2"></td>
</tr>
<tr>
<td width="364"> 3. Hide......</td>
<td width="20"><input type="checkbox" name="name" value="value3"></td>
</tr>
<tr>
<td width="364"> 4. Hide......</td>
<td width="20"><input type="checkbox" name="name" value="value4"></td>
</tr>
<tr>
<td width="364"> 5. Hide......</td>
<td width="20"><input type="checkbox" name="name" value="value5"></td>
</tr>
</table>
<br/>
<input type="button" value="Delete" onclick="hide_checkbox();">
</form>
please help for the solution...
<script type="text/javascript">
function hide_checkbox(){
findTr = function(el) {
while (el.parentNode) {
el = el.parentNode;
if (el.tagName.toLowerCase() == 'tr')
return el;
}
}
form = document.getElementById("form");
var check = form.elements;
for(var i = check.length - 1; i > -1 ; --i){
if(check[i].type == 'checkbox' && check[i].checked){
var checkedCheckbox = findTr(check[i])
if(checkedCheckbox){
checkedCheckbox.style.display = 'none';
}
}
}
}
</script>
<form id="form" action="" >
<table width="400" border="1">
<tr>
<td width="364"> 1. Hide......</td>
<td width="20"><input type="checkbox" name="name" value="value1"></td>
</tr>
<tr>
<td width="364"> 2. Hide......</td>
<td width="20"><input type="checkbox" name="name" value="value2"></td>
</tr>
<tr>
<td width="364"> 3. Hide......</td>
<td width="20"><input type="checkbox" name="name" value="value3"></td>
</tr>
<tr>
<td width="364"> 4. Hide......</td>
<td width="20"><input type="checkbox" name="name" value="value4"></td>
</tr>
<tr>
<td width="364"> 5. Hide......</td>
<td width="20"><input type="checkbox" name="name" value="value5"></td>
</tr>
</table>
<br/>
<input type="button" value="Delete" onclick="hide_checkbox();">
</form>
please help for the solution...