猿问

为什么不能填充red颜色

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title></title>

</head>

<body>

<canvas id="canvas" style="border:1px solid #aaa; display: block; margin: 50px auto; "></canvas>

<script>

window.onload=function(){

var canvas=document.getElementById("canvas");

canvas.width=800;

canvas.height=800;

var context=canvas.getContext("2d");

context.beginPath();

context.moveTo(100,100);

context.lineTo(700,700);

context.lineTo(100,700);

context.closePath();

context.lineWidth=10;

context.fillStyle="red";

context.strokeStyle="#058"; 

context.stroke();

ontext.fill();

}

</script>

</body>

</html>


逆水行
浏览 979回答 1
1回答

逆水行

我自己找到了缺了个c
随时随地看视频慕课网APP

相关分类

Html5
我要回答