<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>canvas</title>
</head>
<body>
<canvas id="canvas" style="display:block;margin:10px auto;
border:1px solid #aaa;"></canvas>
<script>
window.onload = function() {
var canvas=document.getElementById('canvas');
var context=canvas.getContext('2d');
canvas.weight = 1000;
canvas.height = 300;
context.beginPath();
context.moveTo(20,20);
context.lineTo(200,100);
context.closePath();
context.lineWidth=5;
context.stroke();
}
</script>
</body>
</html>