If you would like to learn more about graphics programming with HTML5 and JavaScript, you will find this good and well documented Tetris project by US developer Sergey Kryukov.
For some years now, he developing his Tetris written with HTML and JavaScript / Canvas. The origins of the code are even deeper because Kryukov has resorted to the low-level algorithms of an older Tetris project by Jake Gordon.

The sourcecode is available on CodeProject: Link