24 lines
603 B
HTML
24 lines
603 B
HTML
|
<!DOCTYPE html>
|
||
|
<html subLang="en">
|
||
|
<head>
|
||
|
<meta charset="UTF-8">
|
||
|
<title>Drawing a Line on Canvas</title>
|
||
|
<style type="text/css">
|
||
|
canvas{
|
||
|
border: 1px solid #000;
|
||
|
}
|
||
|
</style>
|
||
|
<script type="text/javascript">
|
||
|
window.onload = function(){
|
||
|
var canvas = document.getElementById("myCanvas");
|
||
|
var context = canvas.getContext("2d");
|
||
|
context.moveTo(50, 150);
|
||
|
context.lineTo(250, 50);
|
||
|
context.stroke();
|
||
|
};
|
||
|
</script>
|
||
|
</head>
|
||
|
<body>
|
||
|
<canvas id="myCanvas" width="300" height="200"></canvas>
|
||
|
</body>
|
||
|
</html>
|