小语教师验证| 初语教师验证|扬州教师验证|快速获积分| 宣传获积分 微信宣传得积分| 积分换VIP |积分来源
唐老师网站
唐老师网站提供免费义务教育阶段语文教学资源库服务。有希望合作者,请联系我们。 合作内容:1.资源共同开发、宣传、使用。2.网络与语文教学结合技术支持。3.宣传推荐学校、机构、个人及产品。4.为本站用户提供免费产品或服务。5.其他合作内容。

TOP

迷宫游戏 代码
2013-07-29 13:51:05 来源:唐老师网站 作者: 【 】 浏览:845次 吐槽:0
最近浏览过的会员: (查看更多)


<!--第一步:先将下列代码复制到<head></head>之间:-->
<!-- Start of Game -->
<basefont FACE="verdana" size="2">
<SCRIPT>
function ShowMenu(bMenu) {
document.all.idFinder.style.display = (bMenu) ? "none" : "block"
document.all.idMenu.style.display = (bMenu) ? "block" : "none"
idML.className = (bMenu) ? "cOn" : "cOff"
idRL.className = (bMenu) ? "cOff" : "cOn"
return false
}
</SCRIPT>
<STYLE>
<!--
A.cOn {text-decoration:none;font-weight:bolder}
#article {font: 12pt Verdana, geneva, arial, sans-serif;  background: white; color: black; padding: 10pt 15pt 0 5pt}
#article P.start {text-indent: 0pt}
#article P {margin-top:0pt;font-size:10pt;text-indent:12pt}
#article #author {margin-bottom:5pt;text-indent:0pt;font-style: italic}
#pageList P {padding-top:10pt}
#article H3 {font-weight:bold}
#article DL, UL, OL {font-size: 10pt}
-->
</STYLE>

<SCRIPT>
<!--
function addList(url,desc) {
if ((navigator.appName=="Netscape") || (parseInt(navigator.appVersion)>=4)) {
var w=window.open("","_IDHTML_LIST_","top=0,left=0,width=475,height=150,history=no,menubar=no,status=no,resizable=no")
var d=w.document
if (!w._init) {
d.open()
d.write("<TITLE>Loading...</TITLE><EM>Loading...</EM>")
d.close()

w.opener=self   
window.status="Personal Assistant (Adding): " + desc
} else {
window.status=w.addOption(url,desc)   
w.focus()
}
}
else
alert("Your browser does not support the personal assistant.")
return false
}
// -->
</SCRIPT>

<STYLE TYPE="text/css">
#board TD {width: 15pt; height: 15pt; font-size: 2pt; }
TD.foot {font-size: 10pt;}
#board TD.start {font-size: 8pt; border-left: 2px black solid; background:yellow; border-top: 2px black solid;text-align: center; color: red}
#board TD.end {font-size: 8pt; text-align: center; color: green}
#message {margin: 0pt; padding: 0pt; text-align: center}
</STYLE>

 

 


<!--第二步:再将下列代码复制到<body></body>之间:-->
<SCRIPT LANGUAGE="java script">
    var maze = new Array()
    var sides = new Array("Border-Top", "Border-Right")
    for (var rows=0; rows<13; rows++)
      maze[rows] = new Array()
    maze[0][0] = new Array(1,1,1,1,1,1,1,1,1,1,1,1)
    maze[0][1] = new Array(0,0,1,0,1,0,0,0,0,1,0,1)
    maze[1][0] = new Array(1,0,0,0,1,0,1,1,1,0,1,1)
    maze[1][1] = new Array(0,1,1,0,0,1,1,0,0,1,0,1)
    maze[2][0] = new Array(1,0,1,0,1,0,0,1,1,0,1,1)
    maze[2][1] = new Array(0,0,0,0,1,1,1,0,0,0,0,1)
    maze[3][0] = new Array(0,1,1,1,1,1,0,0,0,0,1,1)
    maze[3][1] = new Array(1,0,0,1,0,0,0,1,1,0,0,1)
    maze[4][0] = new Array(0,0,0,0,0,0,1,1,1,1,1,1)
    maze[4][1] = new Array(1,1,1,1,1,0,0,0,0,0,1,1)
    maze[5][0] = new Array(0,0,0,0,1,0,1,1,1,1,0,0)
    maze[5][1] = new Array(1,1,1,1,1,1,0,0,0,1,0,1)
    maze[6][0] = new Array(0,0,0,0,0,0,1,1,0,1,0,1)
    maze[6][1] = new Array(1,1,1,1,1,1,0,0,0,1,0,1)
    maze[7][0] = new Array(1,0,1,0,0,0,1,0,1,1,0,1)
    maze[7][1] = new Array(1,1,1,0,1,0,0,1,0,1,1,1)
    maze[8][0] = new Array(0,0,0,1,0,0,1,1,0,0,0,0)
    maze[8][1] = new Array(0,1,0,1,1,0,0,0,1,1,0,1)
    maze[9][0] = new Array(0,0,0,0,0,1,1,1,1,0,1,1)
    maze[9][1] = new Array(1,1,1,1,0,0,0,0,0,1,1,1)
    maze[10][0] = new Array(0,0,0,0,0,1,1,1,1,1,0,0)
    maze[10][1] = new Array(1,1,1,0,1,0,0,0,0,1,0,1)
    maze[11][0] = new Array(0,0,1,1,1,1,1,1,1,0,0,0)
    maze[11][1] = new Array(1,0,1,0,0,0,0,0,0,0,1,1)
    maze[12][0] = new Array(0,0,0,0,0,1,1,1,1,0,1,0)
    maze[12][1] = new Array(1,1,0,1,0,0,0,1,0,0,1,1)

    function testNext(nxt) {
      if ((board.rows[start.rows].cells[start.cols].style.backgroundColor=="yellow") && (nxt.style.backgroundColor=='yellow')) {
        message.innerText="I see you changed your mind."
        board.rows[start.rows].cells[start.cols].style.backgroundColor=""
        return false
      }
      return true
    }   

    function moveIt() {
      if (!progress) return
      switch (event.keyCode) {
        case 37: // left
          if (maze[start.rows][1][start.cols-1]==0) {
            if (testNext(board.rows[start.rows].cells[start.cols-1]))
              message.innerText="Going west..."
            start.cols--
            document.all.board.rows[start.rows].cells[start.cols].style.backgroundColor="yellow"
          } else
          message.innerText="Ouch... you can't go west."

          break;
        case 38: // up
          if (maze[start.rows][0][start.cols]==0) {
            if (testNext(board.rows[start.rows-1].cells[start.cols]))
              message.innerText="Going north..."
            start.rows--
            document.all.board.rows[start.rows].cells[start.cols].style.backgroundColor="yellow"
          } else
          message.innerText="Ouch... you can't go north."

          break;
        case 39: // right
         
          if (maze[start.rows][1][start.cols]==0) {
            if (testNext(board.rows[start.rows].cells[start.cols+1]))
              message.innerText="Going east..."
            start.cols++
            document.all.board.rows[start.rows].cells[start.cols].style.backgroundColor="yellow"
          }
          else
          message.innerText="Ouch... you can't go east."

          break;
        case 40: //down
          if (maze[start.rows+1]==null) return
          if (maze[start.rows+1][0][start.cols]==0) {
            if (testNext(board.rows[start.rows+1].cells[start.cols]))
              message.innerText="Going south..."
            start.rows++
            document.all.board.rows[start.rows].cells[start.cols].style.backgroundColor="yellow"
          } else
          message.innerText="Ouch... you can't go south."

          break;
      }
      if (document.all.board.rows[start.rows].cells[start.cols].innerText=="end") {
        message.innerText="You Win!"
        progress=false
      }
    }
</SCRIPT>

<P ALIGN=center>请使用键盘上的→←↑↓键进行游戏</P><BR>
<p><TABLE ID=board ALIGN=CENTER CELLSPACING=0 CELLPADDING=0>
  <SCRIPT LANGUAGE="java script">
    for (var row = 0; row<maze.length; row++) {
      document.write("<TR>")

      for (var col = 0; col<maze[row][0].length; col++) {
        document.write("<TD STYLE='")
        for (var cell = 0; cell<2; cell++) {
          if (maze[row][cell][col]==1)
            document.write(sides[cell]+": 2px black solid;")
        }
        if ((0==col) && (0!=row))
          document.write("border-left: 2px black solid;")
        if (row==maze.length-1)
          document.write("border-bottom: 2px black solid;")
        if ((0==row) && (0==col))
          document.write(" background-color:yellow;' class=start>start</TD>")
        else
         if ((row==maze.length-1) && (col==maze[row][0].length-1))
           document.write("' class=end>end</TD>")
         else
          document.write("'>&nbsp;</TD>")
      }
      document.write("</TR>")
    }
    var start = new Object
    start.rows = 0
    start.cols = 0
    progress=true
    document.onkeydown = moveIt;
  </SCRIPT>
  </TABLE>
  <P ID="message">&nbsp;</P>
<!-- End of Game -->

相关搜索
中搜索:迷宫游戏 代码
中搜索:迷宫游戏 代码
中搜索:迷宫游戏 代码
45
Tags:迷宫 游戏 代码 分享网友:admin
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【吐槽】 【关闭】 【返回顶部
分享到QQ空间
分享到: 
上一篇检测来访系统 下一篇打开 关闭 窗口代码

坚持党对教育事业的全面领导,坚持把立德树人作为根本任务,坚持优先发展教育事业.

相关栏目

最新文章

内容加载中,请稍候...

图片主题

内容加载中,请稍候...

热门文章

内容加载中,请稍候...

推荐文章

内容加载中,请稍候...

相关文章

内容加载中,请稍候...

贡献者排行榜(感谢“唐老师们”)

您正在浏览:迷宫游戏 代码 需要更多请站内搜索,还是没有请免费向我们索取。
唐老师网站**********************一线语文教师互动分享***************部编版统编语文
关于本站 ----广告服务---版权申明---联系我们---网站地图 --
本网大部分资源来源于会员上传,除本网组织的资源外,版权归原作者所有,如有侵犯版权,请立刻和本网联系并提供证据,本网将在三个工作日内改正。
Copyright © 2009 - 2013 520yuwen. All Rights Reserved 工信部备案苏ICP备05032846-1号
站长:唐桂荣

苏公网安备 32100302010062号

本站与www.yz110.com同为“唐老师网站”旗下网站。