1. getElementsByTagName return an array. Access the 1st element by using canvas or just use Id directly.
2. The canvas may not be created yet, wrap the code in window.onload.
3. Meet Mehta Please don't encourage the use of resizing canvas through CSS.
It also scales the bitmaps inside.