묻고답하기

<head>
<script language="javascript">
<!--
function test(c) {
td1.style.background='black';
td2.style.background='black';
td3.style.background='black';
td4.style.background='black';
c.style.background='white';
}
//-->
</script>
</head>

</body>
<TABLE width=100 height=50 style='background-color:red;'>
<TR>
        <TD id=td1 onclick="test(td1)" style='background-color:black;'></TD>
        <TD id=td2 onclick="test(td2)" style='background-color:black;'></TD>
        <TD id=td3 onclick="test(td3)" style='background-color:black;'></TD>
        <TD id=td4 onclick="test(td4)" style='background-color:black;'></TD>
</TR>
</TABLE>
</body>
여기서...
td1.style.background='black';
td2.style.background='black';
td3.style.background='black';
td4.style.background='black';
이부분을

for(i=1;i++;i<4) {
(td+"i").style.background='black';
}
이렇게 만들고 싶은데...
(td+"i") 이부분이 문법에 맞지 않은거 같은데...
좋은 방법이 없을까요?