郁闷到不知错哪里..
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body>
<canvas id="canvas" style="display:block;margin:50px auto;"></canvas>
<script src="canvas/源文件/digit.js"></script>
<script src="canvas/js/countdown.js"></script>
</body>
</html>
// JavaScript Document
var WINDOW_WIDTH=1024;
var WINDOW_HEIGHT=768;//方便以后修改
var RADIUS=8;
window.onload = function(){
var canvas = document.getElementById('canvas');
var context = canvas.getContext("2d");
canvas.width = WINDOW_WIDTH;
canvas.height = WINDOW_HEIGHT;
render( context )
}
function render(cxt){
var hours=12;
var minutes=34;
var second=56;
renderDigit(0,0,paseInt(hours/10),cxt)
}
function renderDigit( x , y , num , cxt ){
cxt.fillStyle = "rgb(0,102,153)";
for( var i = 0 ; i < digit[num].length ; i ++ ){
for(var j = 0 ; j < digit[num][i].length ; j ++ ){
if( digit[num][i][j] == 1 ){
cxt.beginPath();
cxt.arc(x+j*2*(RADIUS+1)+(RADIUS+1) , y+i*2*(RADIUS+1)+(RADIUS+1) , RADIUS , 0 , 2*Math.PI )
cxt.closePath()
cxt.fill()
}
}
}
}