{ var background_color = "rgb(0,204,204)"; //新背景色 var frozen_back_color = new Array(); var back_color = new Array(); var ignor_list = "[id^=B]"; //指定某些列不高亮,形如[id^=A],[id^=B],逗号分割 var $last_tr; var i = 0; var nHead = 3; $(".x-table tr[id]:gt(" + nHead + ")").bind("mouseenter", function() { if(typeof($last_tr) != "undefined") { if(typeof($(this).attr("id")) != "undefined") { if(typeof($("#content-container #frozen-west").attr("id")) != "undefined") { $("#content-container #" + $last_tr.attr("id")).each(function() { $(this).children("td").each(function() { $(this).css("background-color", frozen_back_color[$(this).index()]); }); i = i + 1; }); i = 0; } else { $last_tr.children("td").each(function() { $(this).css("background-color", back_color[$(this).index()]); }); } frozen_back_color = []; back_color = []; } } if(typeof($(this).attr("id")) != "undefined") { if(typeof($("#content-container #frozen-west").attr("id")) != "undefined") { $("#content-container #" + $(this).attr("id")).each(function() { frozen_back_color = new Array(); $(this).children("td").not(ignor_list).each(function() { frozen_back_color[$(this).index()] = $(this).css("background-color"); if(typeof($(this).attr("rowspan")) == "undefined") { $(this).css("background-color", background_color); } }); i = i + 1; }); i = 0; } else { $(this).children("td").not(ignor_list).each(function() { back_color[$(this).index()] = $(this).css("background-color"); if(typeof($(this).attr("rowspan")) == "undefined") { $(this).css("background-color", background_color); } }); } } }); $(".x-table tr[id]:gt(" + nHead + ")").bind("mouseleave", function() { if(typeof($(this).attr("id")) != "undefined") { $last_tr = $(this); } }); } |