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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

hiding TRs using css

Status
Not open for further replies.

tamakre

Programmer
Sep 29, 2007
8
0
0
US
Im trying to find a way to hide multiple table rows using something like
Code:
document.getElementById("News").style.display  = 'none';


... in my table, the rows are assigned and 'id' based on dynamic content drawn from a database... the id is the content type ... News, Blog, Other... What Im trying to do is wherever (in this table) the TR id is "NEWS" - I want that to be able to be hidden using a radio button with an onclick that calls javascript or something to trigger the 'hide'.

Is this do-able ... do I need to post this in the Javascript forum instead?

 
You should change your code. ID is a unique element identifier and can be used on the page only once. That is why your code is failing, because all other ids after the first one are ignored. Here's another way to do it. Switch from ids to classes for your items. Then put all your items in an element with an id of itemslist or something. Then you change the class on the itemlist to be .shownews, .showblog and .showother for example. And in your css you have:
Code:
.shownews .blog, .shownews .other {
  display: none;
}
...
And so on. This way you only need to change one element to have them all change.

___________________________________________________________
[small]Do something about world cancer today: PACT[/small]
 
thanks, I chickened out and just filtered using recordset parameter and allow the user to toggle with TR's to show based on a drop menu - via an onChange javascript function. I've noted your response/solution for another project Im working on though - thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top