0

我在一个站点中找到了 html5 游戏(一个有电脑的玩家)并将其转换为 2 个玩家。这是我总结的代码:

<html>
<head><title></title></head>
<body onload="javascript: paintBoard();">
<canvas width="500" height ="500" id="board" onclick="javascript: clickHandler(event);"
</canvas>

<script>
....  //my html5 game logic is written in here that works correctly
</script>
</script>
</body>
</html>

当我运行浏览器以在浏览器中查看我的(此文件名是 tictactoe.html)代码时,查看游戏没问题,但是当我将此代码放到另一个具有模板的页面时,我什么都看不到。那个页面名称正在播放。 php 和这样的:

<!DOCTYPE HTML>
<html>

<head>
<title>world Game Center </title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<!-- stylesheets -->
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link href="css/light.css" rel="stylesheet" type="text/css" />

<!-- modernizr enables HTML5 elements and feature detects -->
<script type="text/javascript" src="js/modernizr-1.5.min.js"></script>
<script type="text/javascript" src="js/tictactoe.js"></script>  //this is the game    logic that i suggest above.

</head>
<body >
<div id="main">

<!-- begin header -->
<header>
<nav>
<ul class="sf-menu" id="nav">
<li><a href="index.php">home</a></li>          
</ul>
</nav>
<div id="logo"><h1>game center <a href="#">online</a>world</h1></div>
</header>
<!-- end header -->

<!-- begin content -->
<div id="site_content">
<div id="left_content">
<center>        
<form id="name_form">
<h1>chat</h1>
        <!--   <input type=text id="name_input"
                   style="width: 200px; margin: 2px" disabled>

            <input type="submit" id="connect_button" value="Connect"
                   style="width: 70px; margin: 2px" disabled>

        </form>
        -->
        <textarea id="chat_box" readonly="readonly"
                  style="width: 400px; height: 400px;
                         margin: 2px; resize: none"></textarea>
        </textarea>
        <form id="message_form">
            <input type=text id="message_input"
                   style="width: 220px; height: 18px; margin: 2px" disabled>
            <input type="submit" id="send_button" value="Send"
                   style="width: 60px; margin: 2px" disabled>
        </form>
    </center>
  </div>
  <div id="right_content">
    <canvas width="500" height ="500" id="board" onclick="javascript: clickHandler(event);"></canvas>
  </div>
</div>
<!-- end content -->

</div>
<!-- javascript at the bottom for fast page loading -->
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.easing-sooper.js"></script>
<script type="text/javascript" src="js/jquery.sooperfish.js"></script>
<!-- initialise sooperfish menu -->
<script type="text/javascript">
$(document).ready(function() {
$('ul.sf-menu').sooperfish();
 });
</script>
4

0 回答 0