效果如下:

代碼如下:
<!DOCTYPE html><html> <head> <meta charset="utf-8"> <title></title> <style> #canvasWrap{ width: 600px; height: 550px; margin: 50px auto; } #currActive{ font-size: 20px; font-weight: bold; /*text-align: center;*/ margin-left:230px ; } #canvas{ float: left; background: #EAC591; } #panel{ width: 80px; padding: 10px; float: right; } #ul{ list-style: none; margin: 0; padding: 0; } #ul li{ padding: 2px; } </style> <script src="http://libs.baidu.com/jquery/1.9.1/jquery.min.js"></script> </head> <body> <div id="canvasWrap"> <div id="currActive"></div> <canvas id="canvas" width="500" height="550"></canvas> <div id="panel"> <ul id="ul"></ul> </div> </div> <script> var obj = {}; // 初始化 obj.init = function(args){ var canvas = document.getElementById("canvas"); this.ctx = canvas.getContext("2d");// this.chunk =args&&args.chunk?args.chunk:50; // this.radius =args&&args.radius?args.radius:23; // this.CandidateCircleR =args&&args.ccr?args.ccr:5; this.radius = 23; this.chunk =50; this.CandidateCircleR = 5; $("#currActive").text("紅方"); this.steps = []; // 記錄步驟 this.currActive = "red"; // 先下 this.init_back(); this.init_chess(); $(canvas).unbind(); this.addEvent(); } // 棋盤初始化 obj.init_back = function(){ this.drawRowLine(); this.drawColLine(); this.ctx.clearRect(this.chunk+1, this.chunk*5+1, this.chunk*8-2, this.chunk-2); this.drawsharpS(); this.drawX(); this.drawText(); } // 棋子初始化 obj.init_chess = function(){ var Car_b1 = {x:1,y:1,text:"
主站蜘蛛池模板:
封开县|
大宁县|
佛坪县|
城步|
克拉玛依市|
蒲城县|
尖扎县|
赞皇县|
永泰县|
蓬溪县|
连城县|
垫江县|
广昌县|
微山县|
濮阳县|
塔城市|
万载县|
海南省|
蓬安县|
芮城县|
沧源|
鄄城县|
曲松县|
桐乡市|
江华|
临猗县|
中西区|
夏河县|
新绛县|
梨树县|
含山县|
民县|
舒兰市|
无棣县|
喀喇|
巴塘县|
太康县|
苗栗市|
虹口区|
建阳市|
中超|