you can do it this way
var rowCount=0;
$('#tbl tr').each(function () {
if(rowCount%2==0){
//document.getElementById(grpid).style.background = '#3875D7';
$(this).css(background,'#3875D7');
}else
{
//document.getElementById(grpid).style.background = '#3875D9';
$(this).css(background,'#3875D9');
}
rowCount++;
});
EDITED:
Code has been converted to pure jQuery standard
happy Coding :)