troubleshooting Question

TD background coloring

Avatar of Isaac
IsaacFlag for United States of America asked on
Microsoft SharePoint
1 Comment1 Solution331 ViewsLast Modified:
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> 
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros