for(var j = 0; j < 3;j++){ table.lastChild.appendChild(td); if(j == 2){ table.lastChild.appendChild(a); } }效果图: 查看完整描述