不支持HTML5 Canvas元素



以下代码在HTML页面中创建Canvas元素,我已经使用了这个代码,但错误显示在下面

<canvas id="exmpl" width="300" height="300">
This is Canvas Element..
</canvas>

使用JavaScript,我在画布上绘制了:

var exmpl= document.getElementById('exmpl');
var context = example.getContext('2d');
context.fillStyle = 'red';
context.fillRect(30, 30, 50, 50);

此代码在屏幕上绘制一个红色矩形。

此代码非常完美。如果使用canvas标记,请始终使用更高级别的版本。

var exmpl= document.getElementById('exmpl');
var context = example.getContext('2d');
context.fillStyle = 'red';
context.fillRect(30, 30, 50, 50);

最新更新