Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hide Table Row

Status
Not open for further replies.

Dronealone

IS-IT--Management
Mar 13, 2002
64
GB
Hi,

Can anybody tell me how to make the following code Mozilla friendly, works fine in IE6...

function toggle(target)
{
obj=(document.all) ? document.all[target] : document.getElementById(target);

obj.style.display=(obj.style.display=='none') ? 'inline' : 'none';

}

This function used in conjunction with these table rows:

<tr valign="top">
<td bgcolor="#ffffff"><b>Question?</b> *</td><td bgcolor="#ffffff"><INPUT type="radio" value="Y" name="consulting" onClick="toggle('interest')"> yes <INPUT
type="radio" CHECKED value="N" name="consulting" onClick="toggle('interest')"> no</td>
</tr>

<tr id="interest" style="display:none;" valign="top">
<td bgcolor="#ffffff">
<b>Another question?</b>
</td>
<td bgcolor="#ffffff">
<INPUT type="radio" value="internal" name="software_interest" CHECKED> Internal work<br>
<INPUT type="radio" value="external" name="software_interest"> External engagements
</td>
</tr>

Thanks very much!
 

Well, the javascript looks as if it would work okay. What error are you getting?
 
Not getting an error, however in firebird the row does not fully appear when the item is clicked on, only partiallly...
 
I've just downloaded Firebird 0.8 and had something very similar happen with one of my tables (an IE 5.5 SP2, IE 6 tested and working solution).

There are some problems with colspan causing my issues -- and I notice that it doesn't handle setting display:none back onto a row either. Methinks there are bugs with the way it manages tables in general.

Anyone else?
Jeff
 
Nope still no better!

Have changed the function to:

function toggle(target)
{
obj=(document.all) ? document.all[target] : document.getElementById(target);

obj.style.display=(obj.style.display=='none') ? 'block' : 'none';
}

This now works in Firebird(to an extent) - after the row is made visible it adds a load of white space afterwards and does this each time you click hide/show.
 
I thought that document.all wasn't supported by Mozilla or Netscape.

There's always a better way. The fun is trying to find it!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top