为啥我的WINDOW_HEIGHT=0?导致我的时间显示不出来啊?
window.onload = function (){
WINDOW_WIDTH = document.body.clientWidth;
WINDOW_HEIGHT = document.body.clientHeight;
alert(WINDOW_HEIGHT)
MARGIN_LEFT = Math.round(WINDOW_WIDTH/10);
RADIUS = Math.round(WINDOW_WIDTH*4/5/108)-1;
MARGIN_TOP = Math.round(WINDOW_WIDTH/5);
var canvas = document.getElementById("canvas");
var context = canvas.getContext("2d");
WINDOW_WIDTH = window.screen.width;
WINDOW_HEIGHT = window.screen.height ;
这个更准确 不用撑开dom节点就能用
WINDOW_WIDTH = document.documentElement.clientWidth;
WINDOW_HEIGHT = document.documentElement.clientHeight;
你没有把body撑开,将body或者html设置为100%,再把canvas的高度设为100%