<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>二次贝塞尔曲线</title>
</head>
<style>
.canvas{
border:1px solid #000;
display:block;
margin:0 auto;
/*width:100%;
height: 500px;*/
}
</style>
<body>
<canvas id='canvas'>
浏览器不支持canvas
</canvas>
</body>
<script>
window.onload=function(){
var canvas=document.getElementById("canvas");
canvas.width=800;
canvas.height=800;
var context = canvas.getContext('2d');
context.font='bold 40px Arial';
context.fillStyle='#058';
context.fillText('canvas文字渲染欢迎您',40,100);
context.lineWidth=1;
context.strokeStyle='#058';
context.strokeText=('canvas文字渲染欢迎您',40,200);
}
</script>
</html>
context.font='bold 40px Arial';
应该是context.font="40px bold Arial";老师写错误!
context.strokeText=('canvas文字渲染欢迎您',40,200);没有=号