DIV CSS 佈局教程網

jQuery 線上五子棋遊戲完整程式碼
編輯:JQuery常見問題     

在線五子棋試玩:https:///game/12/

這是一個以 jQuery 實作的五子棋遊戲,具備重新開始、悔棋與中英文切換等功能。以下為完整程式碼,存檔為 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="https:///game/12/main.css" />
 <script type="text/javascript" src="https:///keleyi/pmedia/jquery/jquery-1.10.2.min.js"></script>
 <script type="text/javascript" src="https:///game/12/locale.js"></script>
 <script type="text/javascript" src="https:///game/12/gomoku.js"></script>
 <script type="text/javascript">
 var turn = 1, role = ['AI', 'human'];
 $(function () {
   var gomoku = new Gomoku();
   gomoku.init(role[turn]);
   $('#restart').click(function () {
     gomoku.restart.call(gomoku, role[turn]);
   });
   $('#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>
 </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>
 </body>
</html>
XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved