您的位置:首页 - jQuery
jquery在线五子棋代码
在线五子棋试玩地址:http://keleyi.com/game/12/



以下是完整代码,保存到html文件打开也可以玩:
<!DOCTYPE html>
<html>
<head>
<title>在线五子棋-柯乐义</title><base target="_blank" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="stylesheet" type="text/css" href="http://keleyi.com/game/12/main.css" />
<script type="text/javascript" src="http://keleyi.com/keleyi/pmedia/jquery/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="http://keleyi.com/game/12/locale.js"></script>
<script type="text/javascript" src="http://keleyi.com/game/12/gomoku.js"></script>
<script type="text/javascript">
var turn = 1, role = ['AI', 'human'];
$(function () {
var gomoku = new Gomoku();
gomoku.init(role[turn]);
//turn = turn === 0 ? 1 : 0;
$('#restart').click(function () {
gomoku.restart.call(gomoku, role[turn]);
// turn = turn === 0 ? 1 : 0;
});
$('#regret').click(function () {
gomoku.regret.call(gomoku);
});
});
</script>
</head>
<body>
<div id="toolbar">
<div class="top">
<span class="switch-lang">
<a href="javascript:;" id="zh-cn">简体中文</a>
<a href="javascript:;" id="en">English</a>
</span>
<span class="copy">
&copy;<a href="http://keleyi.com/">柯乐义</a>
</span>
</div>
You: Black, AI: White, Round: <span id="round">0</span>
<button id="restart">Restart</button>
<button id="regret">Regret</button>
</div>
<div id="output"></div>
<div id="main" ></div>
<div style="width:736px;margin:10px auto;clear:both;position:absolute;top:560px;left:0px;right:0px;"><a href="http://keleyi.com/game/">更多游戏</a></div>
</body>
</html>

更多游戏
本站导航
相关文章
柯乐义 Copyright© keleyi.com