<Javascript> function check(chkbox, n){ ..... document.getElementById("id"+n).style.background='url(img/image'+n+'.jpg)'; ..... } </Javascript>