Согласно ответу @ obsidian, это будет что-то вроде этого:
function chbg(color) {
document.getElementById(id).style.backgroundColor = color;
document.getElementById(id).style.backgroundColor.setAttribute("fill", "red")
}
, если оно больше chbg(color, id, td, fc)
function chbg(color, id, td, fc) {
document.getElementById(id).style.backgroundColor = color;
document.getElementById(id).style.textDecoration = td;
document.getElementById(id).style.color = fc;
}
Тест