facebook twitter hatena line email

Javascript/canvas

提供: 初心者エンジニアの簡易メモ
移動: 案内検索

helloworld

<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script>
$(function() {
var canvas = document.getElementById('sample');
var context = canvas.getContext('2d');
context.fillStyle = 'rgb(255,00,00)'; // 塗りつぶし
context.fillRect(20,40,50,100); // 四角
});
</script>
</head>
<body>
<canvas width="400" height="300" id="sample"></canvas>
</body>
</html>