画布没有用,我不能画任何东西

时间:2014-11-02 16:46:04

标签: jquery

我无法画任何东西,有没有人看到错误?我想尝试按下按钮,没有工作,文件准备就绪时也不起作用。

<!doctype html>
<html>
<head>
<script src='jcanvas.min.js'></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<meta charset="utf-8">
<title>IO</title>
<script>
$(document).ready(function(){
    $('#act').click(function(){
        $('canvas').drawArc({
            fillStyle: 'black',
            x: 100, y: 100,
            radius: 50
            });
    });
    $('canvas').drawArc({
            fillStyle: 'black',
            x: 100, y: 100,
            radius: 50
            });

});
</script>
</head>

<body>
<button id="act" type="button">Actualizar</button>
<p>&nbsp;</p>
<p>
  <input type="number" name="quantity" min="-100000" max="100000">
  </p>
</p>
<canvas id='can' width='500' height='500'></canvas>
</body>
</html>

1 个答案:

答案 0 :(得分:0)

你JCanvas代码很好。

我们在网页中加载脚本文件的顺序很重要。 JCanvas库使用jQuery。 因此,首先加载jQuery可以解决问题。

此外,如果您正在检查本地计算机,则可以使用HTTP加载jQuery CDN。

<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src='jcanvas.min.js'></script>
相关问题