アットウィキロゴ

JQ canvas 2

<!DOCTYPE html>
<html>
 
<head>
<title>ABC</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript">
 
function sample() {
var canvas = document.getElementById('cam');
 
if (canvas.getContext) {
 
var ctx = canvas.getContext('2d');
 
 ctx.beginPath();
  ctx.moveTo(20, 20);
  ctx.lineTo(120, 20);
  ctx.lineTo(120, 120);
  ctx.lineTo(20, 120);
  ctx.stroke(); 
 
} 
}
 
</script>
 
</head>
<body onLoad="sample()">
<h2>図形を描く</h2>
<canvas id="cam"></canvas>
</body>
</html>
最終更新:2013年05月18日 01:24