HTML5中绘制圆形,请问以下两组代码一样,为何一个能显示圆形,一个不能?本人一个小时都没琢磨出来。
<!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"><title>text5.9绘制</title><styl...
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>text5.9绘制</title>
<style type="text/css">
canvas{background:#E59866}
</style>
</head>
<body>
<canvas id="one" width="800" height="600">
您浏览器暂不支持HTML5的canvas元素
</canvas>
<script type="text/javascript">
var canvas=document.getElementById('canvas');
var c=canvas.getContext('2d');
c.lineWidth=6;
c.strokeStyle="green";
c.fillStyle="red";
c.arc(100,50,30,0,Math.PI*2);
c.stroke();
c.beginPath();
c.arc(100,150,30,0,Math.PI*2)
c.fill()
</script>
</body>
</html>
第二组:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>text5.9绘制</title>
<style type="text/css">
canvas{background:#E59866}
</style>
</head>
<body>
<canvas id="canvas" width="800" height="600">
您浏览器暂不支持HTML5的canvas元素
</canvas>
<script type="text/javascript">
var canvas=document.getElementById('canvas');
var c=canvas.getContext('2d');
c.lineWidth=6;
c.strokeStyle="green";
c.fillStyle="red";
c.arc(100,50,30,0,Math.PI*2);
c.stroke();
c.beginPath();
c.arc(100,150,30,0,Math.PI*2)
c.fill()
</script>
</body>
</html> 展开
<html lang="en">
<head>
<meta charset="UTF-8">
<title>text5.9绘制</title>
<style type="text/css">
canvas{background:#E59866}
</style>
</head>
<body>
<canvas id="one" width="800" height="600">
您浏览器暂不支持HTML5的canvas元素
</canvas>
<script type="text/javascript">
var canvas=document.getElementById('canvas');
var c=canvas.getContext('2d');
c.lineWidth=6;
c.strokeStyle="green";
c.fillStyle="red";
c.arc(100,50,30,0,Math.PI*2);
c.stroke();
c.beginPath();
c.arc(100,150,30,0,Math.PI*2)
c.fill()
</script>
</body>
</html>
第二组:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>text5.9绘制</title>
<style type="text/css">
canvas{background:#E59866}
</style>
</head>
<body>
<canvas id="canvas" width="800" height="600">
您浏览器暂不支持HTML5的canvas元素
</canvas>
<script type="text/javascript">
var canvas=document.getElementById('canvas');
var c=canvas.getContext('2d');
c.lineWidth=6;
c.strokeStyle="green";
c.fillStyle="red";
c.arc(100,50,30,0,Math.PI*2);
c.stroke();
c.beginPath();
c.arc(100,150,30,0,Math.PI*2)
c.fill()
</script>
</body>
</html> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询