Uncaught TypeError: Cannot read property 'getContext' of null
报这个错,说明canvas还没加载,就调用getContext方法的错误,
解决方法:(1)将<script type="text/javascript" src="script/script.js"></script> 放在canvas后面;
(2)用JQuery的$( document ).ready()