<!DOCTYPE html>
<html>
<head>
<title>ABC</title>
<script src="jquery.min.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript">
x=0;
function sample(x) {
var canvas = document.getElementById('cam');
var ctx = canvas.getContext('2d');
ctx.beginPath();
ctx.moveTo(x, x);
ctx.lineTo(x+10, x+10);
ctx.stroke();
}
jQuery(document).ready( function() {
$("#but").click(function(){
x=x+20;
sample(x);
});
});
</script>
</head>
<canvas id="cam" width = "500" height = "500"></canvas>
<input id="but" type="button" value="ボタン" />
</body>
</html>
最終更新:2013年05月18日 03:37