为什么我只画出了画布,没画出线啊!?反复对了几遍也没看出和老师写的有啥区别?求高人指点
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Canvas 特效</title>
</head>
<body>
<canvas id="canvas" width="1024" height="768" style="border:1px solid #aaa; display:block; margin:50px auto;" > </canvas>
<script>
window.onload = function(){
var canvas = document.getElementById("canvas");
var cantext = canvas.getContext("2d")
context.moveTo(100,100)
context.lineTo(700,700)
context.stroke()
}
</script>
</body>
</html>