Could you avoid the repetition of style.innerHTML += ' ....' here?
Could you fix the indents of some lines?