We help IT Professionals succeed at work.
Get Started

TD background coloring

Isaac
Isaac asked
on
330 Views
Last Modified: 2012-04-20
When I use the following code to set the background column based on a status, it works perfectly but it hides the "List Tools" tab on the ribbon, which prevents me from getting to the different settings for the list.

Any ideas why that's happening?

Thanks!


<script type="text/javascript" language="javascript"> 
  var x = document.getElementsByTagName("TD") // find all of the TDs 
  var i=0; 
  for (i=0;i<x.length;i++) 
  { 

    if (x[i].className=="ms-vb2") //find the TDs styled for lists 
    {
     if (x[i].innerHTML=="CLOSED") //find the data to use to determine the color 
  { 
    x[i].style.backgroundColor='darkblue'; // set the background color 
    x[i].style.color='white'; //set the font color 
  }
          //repeat the above for each data value 

      if (x[i].innerHTML=="OPEN") //find the data to use to determine the color 
  { 
    x[i].style.backgroundColor='darkgreen'; // set the background color 
    x[i].style.color='white'; //set the font color 
  }
    } 

  } 
</script> 

Open in new window

Comment
Watch Question
Cloud Expert
CERTIFIED EXPERT
Most Valuable Expert 2013
Top Expert 2014
Commented:
This problem has been solved!
Unlock 1 Answer and 1 Comment.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE