Click to See Complete Forum and Search --> : Hiding a row


chadorbaf
11-05-2003, 06:21 PM
Hi,
In my form i need to make a row invisible/visible by clicking a button. Let's say there are 20 check boxes along with other input tags on the form like following :

<form name="frm">

<tr bgcolor="FFC0CB">
<input type=checkbox name="c1">First name
<input type=checkbox name="c2">Last Name
......
.....
</tr>
<tr>
<input type=text name="t1">
<input type=text name="t2">
.....
</tr>

</form>

I'd like to make visible/invisible the entire row which is included of check boxes and lables.

Thanks for sgaring your idea. Would be perfect if any code is available.

Khalid Ali
11-05-2003, 06:29 PM
assign an id attribute with some value to the tr(row) and the using
document.getElementById("trID").visibility="hidden"
visibility="visible"
you can also use
display="none"
or display="block"; depending upon the general page design

chadorbaf
11-06-2003, 01:23 PM
Khalid,
Thanks for the replay.
I tried both visibility & display with no success. Is that depended to the browser or i missed something? or maybe i have to reload the page? i use IE 6.
Please advise.
ali

Khalid Ali
11-06-2003, 01:44 PM
chances are that you are not implementing the suggestion corectly,
show me the code(preferably if you have link to actual page)

chadorbaf
11-06-2003, 01:53 PM
here is the code:

window.frames[1].document.getElementById("chkrow").visibility="hidden";

also tried:
window.frames[1].document.getElementById("chkrow").display="none";


and added id to the row:

<tr id="chkrow" bgcolor="FFC0CB">
<input type=checkbox name="c1">First name
<input type=checkbox name="c2">Last Name
......
.....
</tr>

chadorbaf
11-07-2003, 12:08 PM
Khalid,
Tons of thanks for your help. finally got it to work. Here is the code.


<script>
var ob=document.getElementById("chkrow");
if (ob.style.display=="none") ob.style.display="";
else ob.style.display="none";
</script>


<tr bgcolor="FFC0CB">
<td id="chkrow">
<input type=checkbox name="c1">First name
<input type=checkbox name="c2">Last Name
......
.....
<td>
</tr>


Thanks once again.
ali