-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpt2.html
More file actions
50 lines (44 loc) · 1.09 KB
/
pt2.html
File metadata and controls
50 lines (44 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<!DOCTYPE html>
<html>
<head>
<style>
*{
padding: 0;
margin: 0;
}
body{
background-color: azure;
}
canvas{
background-color: pink;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
margin: auto;
}
</style>
</head>
<body>
<canvas width="400" height="400"></canvas>
</body>
<script type="text/javascript">
window.onload=function(){
var canvas = document.querySelector("canvas");
//取得筆
if(canvas.getContext){
var ctx = canvas.getContext("2d");
ctx.strokeStyle="yellow";
ctx.lineWidth=10;
ctx.lineCap="round";
ctx.lineJoin="round";
ctx.moveTo(100,100);
ctx.lineTo(200,200);
ctx.lineTo(200,100);
ctx.closePath();
ctx.stroke();
}
}
</script>
</html>