>
设为首页
>
收藏本站
>
最新电影
首页
运营资讯
今日英语
图形图像
计算机技术
Asp编程
网站结构化
资源共享
休闲娱乐
访问新站
您现在的位置:
首页
=>
后台技术
=>
脚本特效
=>
游戏娱乐
订阅本栏目
围格子
时间: 2007-10-05 14:14:50 阅读次数:2751
<html> <head> <title>网页特效|www.ffasp.com 飞飞Asp乐园|---围格子</title> </head><body><center> <!--将以下代码加入HTML的<Body></Body>之间--> <style>A.cOn { FONT-WEIGHT: bolder; TEXT-DECORATION: none } #article { BACKGROUND: white; COLOR: black; FONT: 12pt Verdana, geneva, arial, sans-serif; PADDING-BOTTOM: 0px; PADDING-LEFT: 5pt; PADDING-RIGHT: 15pt; PADDING-TOP: 10pt } #article P.start { TEXT-INDENT: 0pt } #article P { FONT-SIZE: 10pt; MARGIN-TOP: 0pt; TEXT-INDENT: 12pt } #article #author { FONT-STYLE: italic; MARGIN-BOTTOM: 5pt; TEXT-INDENT: 0pt } #pageList P { PADDING-TOP: 10pt } #article H3 { FONT-WEIGHT: bold } #article DL { FONT-SIZE: 10pt } UL { FONT-SIZE: 10pt } OL { FONT-SIZE: 10pt } </style> <style>#board { FONT-FAMILY: arial } .dot { BACKGROUND: black; FONT-SIZE: 0pt; HEIGHT: 5px; POSITION: absolute; WIDTH: 5px } #line { FONT-SIZE: 0pt; HEIGHT: 5px; POSITION: absolute } .p1 { BACKGROUND: navy; FONT-SIZE: 0pt; POSITION: absolute } .p2 { BACKGROUND: red; FONT-SIZE: 0pt; POSITION: absolute } .p1B { COLOR: navy; FONT-SIZE: 8pt; FONT-WEIGHT: bold; POSITION: absolute; TEXT-ALIGN: center } .p2B { COLOR: red; FONT-SIZE: 8pt; FONT-WEIGHT: bold; POSITION: absolute; TEXT-ALIGN: center } </style> <style type="text/css">BODY { FONT-FAMILY: "宋体"; FONT-SIZE: 9pt; MARGIN-LEFT: 0px; MARGIN-RIGHT: 0px; MARGIN-TOP: 0px } A { COLOR: black; FONT-SIZE: 13px; FONT-WEIGHT: 400; TEXT-DECORATION: none } A:hover { COLOR: red; FONT-SIZE: 13px; FONT-WEIGHT: 400; TEXT-DECORATION: underline } A:active { COLOR: #ff0033; CURSOR: hand; FONT: 9pt "宋体" } </style> <table border="0" cellPadding="0" cellSpacing="0" width="509"> <TBODY> <tr> <td width="10"></td> <td id="article" vAlign="top" width="499"><p class="start" style="TEXT-ALIGN: left"><font size="+2" style="FONT-SIZE: 14pt; FONT-WEIGHT: bold"><b>围格子(双人对战游戏)</b></font></p> <p>谁围的格子多,谁就赢。</p> <p style="MARGIN-TOP: 5pt"><script> /* DHTML Dots is copyright 1998 insideDHTML.com, LLC. All rights reserved. DHTML Dots cannot be reproduced in any manner without prior consent from insideDHTML.com */ var scale= 25 var size = 5 var totalSize = ((size+1)*scale) + 6 var cache = new Object() var move=0,point=0 var player = true function initCache() { cache.x = 0 cache.y = 0 cache.red = 0 cache.navy = 0 move=0,point=0 } <!-- 此特效使用《酷猪哥特效手册》编辑制作--> <!-- 下载地址:http://www.crazydigger.com--> <!-- 作者:来风 laifeng@0451.com--> function updateScore() { document.all.red.innerText = cache.red document.all.navy.innerText = cache.navy if ((cache.red+cache.navy)==((size-1)*(size-1))) { board.onclick = null document.all.message.innerText = "游戏结束了!" } } function fillPos(x,y) { document.all.board.insertAdjacentHTML("beforeEnd","<DIV class=" + (player ? "p1B" : "p2B") + " ID=\"point"+point+"\">" + (player ? "N" : "R") + "</DIV>") var el = document.all["point"+point].style el.pixelTop = (y*scale)+5 el.pixelLeft = (x*scale)+5 el.pixelWidth = scale - 5 el.pixelHeight = scale - 5 } function checkBoard(x,y,dir, player) { var piece=0 if ("vertical"==dir) { if ((x==size) || (x>1)) { var bPos = boardArray[x-1][y] var nextV = boardArray[x-1][y+1] if ((bPos["vertical"]) && (bPos["horizontal"]) && (nextV["horizontal"])) { point++ piece++ fillPos(x-1,y) } } if ((x==1) || (x<size)) { var nextV = boardArray[x+1][y] var nextH = boardArray[x][y+1] if ((nextV["vertical"]) && (nextH["horizontal"]) && (boardArray[x][y]["horizontal"])) { point++ piece++ fillPos(x,y) } } } else { if ((y==size) || (y>1)) { var nextV = boardArray[x+1][y-1] var bPos = boardArray[x][y-1] if ((bPos["vertical"]) && (bPos["horizontal"]) && (nextV["vertical"])) { point++ piece++ fillPos(x,y-1) } } if ((y==1) || (y<size)) { var nextV = boardArray[x+1][y] var nextH = boardArray[x][y+1] if ((nextV["vertical"]) && (nextH["horizontal"]) && (boardArray[x][y]["vertical"])) { point++ piece++ fillPos(x,y) } } } if (piece>0) { if (player) cache.navy+=piece else cache.red+=piece document.all.message.innerText = "得分,可以接着下!" updateScore() return player } else return !player } function doMouseMove() { if (event.srcElement.className!="dot") { var x = Math.floor(event.offsetX / scale) var y = Math.floor(event.offsetY / scale) var dirX = (event.offsetX % scale) var dirY = (event.offsetY % scale) if ((x<size+1) && (y<size+1) && (y>0) && (x>0)) { if (dirX>=dirY) { if (x<size) { line.style.pixelHeight = 5 line.style.pixelWidth = scale - 5 line.style.pixelTop = (y * scale) line.style.pixelLeft = (x * scale) + 5 cache.direction = "horizontal" } } else { if (y<size) { line.style.pixelWidth = 5 line.style.pixelHeight = scale - 5 line.style.pixelTop = (y * scale) + 5 line.style.pixelLeft = x * scale cache.direction = "vertical" } } cache.x = x cache.y = y } } } function doClick() { if (cache.x==0) return if (boardArray[cache.x][cache.y][cache.direction]) document.all.message.innerText="不能走,请换个地方!" else { document.all.board.insertAdjacentHTML("beforeEnd","<DIV class=" + (player ? "p1" : "p2") + " ID=move"+move+"></DIV>") var el = document.all["move"+move] el.style.top = line.style.top el.style.left = line.style.left el.style.width = line.style.width el.style.height = line.style.height boardArray[cache.x][cache.y][cache.direction]=true var nextPlayer = checkBoard(cache.x,cache.y,cache.direction, player) if (nextPlayer!=player) { player = nextPlayer if (player) { document.all.message.innerText = "蓝色玩家" line.style.border = "1px navy solid" } else { document.all.message.innerText = "红色玩家" line.style.border = "1px red solid" } } } move++ } function buildDiv(x,y, scale) { return ("<DIV CLASS=dot STYLE=\"top:" + (x*scale) + "; left: " + (y*scale) + "\"></DIV>") } var boardArray = new Object function buildBoard() { initCache() board = ("<DIV ID=line STYLE=\"border: 1px navy solid; width: 0; height: 0\"></DIV>") boardArray = new Object() for (var x=1; x < size+1; x++) { boardArray[x] = new Object() for (var y=1; y < size+1; y++) { boardArray[x][y] = new Object boardArray[x][y]["vertical"] = false boardArray[x][y]["horizontal"] = false board+=(buildDiv(x,y, scale)) } } return board } function createGame() { size=parseInt(document.all.setSize.value) if (size>12) size=12 if (size<3) size=3 document.all.setSize.value = size document.all.board.innerHTML = buildBoard() document.all.board.onclick = doClick totalSize = ((size+1)*scale) + 6 document.all.board.style.pixelWidth = totalSize document.all.board.style.pixelHeight = totalSize document.all.message.innerText = "蓝色玩家先开始!" updateScore() } document.write("<DIV ID=board STYLE=\"position: relative; height: "+ totalSize + "; width:" + totalSize + "; border: 1px black solid\">" + buildBoard() + "</DIV>") document.all.board.onmousemove = doMouseMove document.all.board.onclick = doClick </script> </p> <div style="MARGIN-LEFT: 10pt; MARGIN-TOP: 5pt"><p class="start" id="message">蓝色玩家先开始!</p> <dd><br> <table border="1" width="100"> <TBODY> <tr> <td style="COLOR: red"><b>红色</b></td> <td id="red">0</td> </tr> <tr> <td style="COLOR: navy"><b>蓝色</b></td> <td id="navy">0</td> </tr> </TBODY> </table> <p><br> </p> <table width="200"> <TBODY> <tr> <td>游戏大小: </td> <td><input id="setSize" size="2" value="5"></td> </tr> <tr> <td align="middle" colSpan="2"><input onclick="createGame()" type="button" value="新游戏"></td> </tr> </TBODY> </table> <p class="copyright"></p> </dd> </div></td> </tr> </TBODY> </table></center> </body></html>
提示:您可以先修改部分代码再运行
飞飞Asp技术,乐园
站内搜索
:
标题
内容
下一篇
射击 游戏
上一篇
经典游戏 扫雷
本栏目最新
栏目最新列表
经典游戏 俄罗斯方块游戏
闯迷宫 经典游戏
射击 游戏
围格子
自信心测试
网站优化策划
栏目最新列表
增加网站外链的快速方法
网站上线前必做的30个检查
新的友情链接参考标准(没有google的PR情况
优化Google的AdSense广告的五个工具
王通讲SEO八大基础
站点最新
站点最新列表
微博推广的一些技巧
xhEditor v1.1.7 发布,
收集的一些轻量级非常实
50个新鲜兼容最新版本的
javascript中cookie的设
Excel中出现#VALUE!、#D
jquery插件:飞飞表情插件
十个使用HTML5开发的精彩
支持HTML5的浏览器有哪些
飞妮莫属:漫画:如何写出
历史最热10条信息
MIME介绍 及
[
1
] [
2
] [
3
]
巧用Google和迅雷来下载
Transact SQL 常
[
1
] [
2
]
VIA Rhine II Fast Ethe
电脑常用端
[
1
] [
2
] [
3
]
Do you get a kick out
十道羊皮卷 欣赏+mp3版+
每日一句:A friend and
每日一句:Theres no tu
经典__悟透JavaScript
伟哥博客
西安房产
123最新电影
三四六四
关于站点
|
免责声明
|
联系站长
|
网站地图
|
陕ICP备07002804号
WEB技术QQ交流群:72840059
©2007 ffasp.com. 版权所有