<html><head><title>H</title></head> <body> <script type=«text/JavaScript» language=«JavaScript»>
document.write('<span><table border=1 cellspacing=0 cellpadding=0 width=100 height=100><tr><td onclick=draw(event) bgColor=red> </td></tr></table></span>');
function draw(event) { document.getElementById('...event.style.id...').style.backgroundColor = 'green'; //..........<- Тут (может через this)
//document.getElementById(...).innerHTML = }
</script> </body></html>