Hello All -
The situation: I've got a sharepoint form library where I have users submit forms, and I've got infopath and sharepoint playing nicely together, drawing form data in to display it in the sharepoint page. All users are on MS Office 2007, Windows Vista Enterprise, IE7. MOSS 2007. By putting code in a Content Editor Web Part set to be hidden, I can run javascript or jquery once the page loads.

My goal is to color code the backgrounds in the table. So if the column header is "Value" and the data value is >=80, I want to change the background to green. In that same column, if the value is 60<x<80 then I want yellow, and x<=60 should be red.

I googled and found something to color code based on just the cell values, and it is working well, so I'm looking for a tweek to add the condition of the column header name matching. I tried to tweek myself (the first line inside the function()), but all I can get it to do is highlight the header based on the header name. So my existing code looks like this (I call up my jquery.js at our internal location, I've truncated the location):

<script src=".../jquery.js" type="text/javascript"></script>


$("tr.ms-viewheadertr th:contains('Name')",
"#MSO_ContentTable").css("background-color", "#2DA42A");

$Text = $("td .ms-vb2:contains('Green')");

$Text.css("background-color", "#2DA42A");

$Text =$("td .ms-vb2:contains('Yellow')");

$Text.css("background-color", "#F3F61A"); 

$Text =$("td .ms-vb2:contains('Red')");

$Text.css("background-color", "#FF0000"); 


So, for the sake of clarity - the above code does highlight table cells with the words "Green", "Yellow", "Red", and it also highlight fields in the table header with the word "Name".

Advanced thanks for any time you spend reading, thinking, or responding to this.