<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>五子棋</title>
<style>
* {
margin: 0;
}
canvas {
background: white;
margin: 120px auto;
display: block;
box-shadow: 0px 0px 8px #000
}
</style>
</head>
<body>
<canvas height="450" width="450" id="canvas"></canvas>
<script>
var chess = document.getElementById("canvas");
var ctx = chess.getClientRects("2d");
ctx.strokeStyle="#b3b3b3";
var drawChessBoard = function () {
for(var i = 0 ; i < 15 ; i++){
ctx.moveTo(15+i*30,15);
ctx.lineTo(15+i*30,435);
ctx.stroke();
ctx.moveTo(15,15+i*30);
ctx.lineTo(435,15+i*30);
ctx.stroke();
}
}
drawChessBoard();
ctx.beginpath();
ctx.arc(100,100,50,0,Math.PI*2);
ctx.fillStyle = "red";
ctx.fill();
ctx.stroke();
</script>
</body>
</html>
相关问题
- #{facesContext} EL expression not resolved at runt
- jsp caching tag library
- JSP template implementation (Composite View Patter
- how to add a list of string into json object in js
- Two dimensional arraylist with c:foreach jstl tag
相关文章
- jsp里面的画布功能,为什么会出错?求大佬找下问题
- JSP String formatting Truncate
- Forward request from servlet to jsp
- Comparing string and boolean in Expression languag
- Passing a Java object value in Custom JSP tag
- Passing a enum value as a tag attribute in JSP
- Application Error: AccessControlException
- MySQL driver problem in my dynamic web project (JP
修正了兩個地方