Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
<style type="text/css">
/*<![CDATA[*/
.blue {
background-Color:blue;
}
/*]]>*/
</style></head>
<body>
<table id="tst" border="1">
<tr>
<td width="100" ><input type="checkbox" name="" /></td>
</tr>
<tr>
<td><input type="checkbox" name="" /></td>
</tr>
<tr class="blue" >
<td><input type="checkbox" name="" /></td>
</tr>
<tr>
<td><input type="checkbox" name="" /></td>
</tr>
<tr class="blue" >
<td><input type="checkbox" name="" /></td>
</tr>
</table>
<script type="text/javascript">
/*<![CDATA[*/
function Test(id,hex,rgb){
var rows=document.getElementById(id).rows,z0=0,rowcolor;
for (;z0<rows.length;z0++){
rowcolor=zxcSV(rows[z0],'background-Color')
if (rowcolor==hex||rowcolor==rgb){
rows[z0].getElementsByTagName('INPUT')[0].checked='checked';
}
}
}
function zxcSV(obj,par){
if (obj.currentStyle) return obj.currentStyle[par.replace(/-/g,'')];
return document.defaultView.getComputedStyle(obj,null).getPropertyValue(par.toLowerCase());
}
Test('tst','blue','rgb(0, 0, 255)')
/*]]>*/
</script></body>
</html>
Bookmarks