momoMo123
2016-06-10 16:09
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<canvas id="canvas" style="border: 2px solid #000000;">
</canvas>
<!--<script type="text/javascript" src="js/jquery-1.11.0.js" ></script>-->
<script>
window.onload=function (){
var canvas=document.getElementById('canvas');
canvas.width=1024;
canvas.height=768;
//调整浏览器兼容性问题
if(canvas.getContext('2d')){
var context=canvas.getContext('2d');
context.moveTo(100,100)
content.lineTo(800,800)
context.lineWidth(5)
context.strokeStyle='aqua'//颜色是字符串
context.stroke()
}
else{
alert('浏览器不兼容,请选择其他浏览器谢谢!');
}
}
</script>
</body>
</html>
你的content.lineTo(800,800);改成context.lineTo(800,800)
context.lineWidth(5) 改成context.lineWidth = 5
炫丽的倒计时效果Canvas绘图与动画基础
96746 学习 · 1000 问题
相似问题