html文件代码
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head lang = "en">
<meta charset=utf-8" />
<title>121212</title>
<script src="jquery-2.1.3.min.js" type = "text/javascript"></script>
<link href="handwriting.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<canvas id="canvas">
您的浏览器不支持canvas
</canvas>
<script src = "handwriting.js"></script>
</body>
</html>
JS文件代码:
var canvasWidth = 800
var canvasHeight = canvasWidth
var canvas = document.getElementById("canvas")[0]
var context = convas.getContext('2d')
canvas.width = canvasWidth
canvas.height = canvasHeight
var canvas = document.getElementById("canvas")[0]这里要加[0]么?
var canvasWidth=Math.min(800,$(window).width()-20);