步骤 1: 在 HTML 中设置画布,创建一个引用,并获取上下文对象
步骤 2: 绘制矩形、直线、贝塞尔曲线、圆和形状
步骤 3: 显示位图图像
步骤 4: 渐变
步骤 5: 动画
步骤 6: 更多 HTML5 画布提示
<!DOCTYPE html>
<html>
<head>
<meta charset=UTF-8 />
<title>test</title>
<style type="text/css">
</style>
<script type="text/javascript">
var timer = null, SLEEP = 1000
var timef = function ()
{
var time = document.getElementById ('time')
var s = parseInt (time.firstChild.nodeValue)
time.firstChild.nodeValue = s - 1 + 's'
if (s == 1)
{
alert ('time expires')
time.firstChild.nodeValue = '10s'
clearTimeout (timer)
return
}
timer = setTimeout (timef, SLEEP)
}
</script>
</head>
<body>
Remaining Time:
<span id="time">10s</span>
<br / >
<button onclick="timef()">time</button>
</body>
</html>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)