<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> 朝暮数据www.zhaomu.com</TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<style>
#bg{font-size:1pt;
width:200px;
height:260px;
margin-left:300px;
background-color:#0066CC
}
</style>
<script language='javascript'>
<!--
var count=0;
var step=0;
function start()
{
var docBg = document.getElementsByTagName("BODY").item(0);
var mytb = document.createElement('TABLE');
mytb.id="bg";
mytb.border=0;
var mytBody = document.createElement('TBODY');
for(var i=0;i<26;i++)
{
var rows = document.createElement('TR');
for(var j=0;j<20;j++)
{
var cells = document.createElement('TD');
cells.id="r"+i+"c"+j;
var textN = document.createTextNode("");
cells.appendChild(textN);
rows.appendChild(cells);
}
mytBody.appendChild(rows);
}
mytb.appendChild(mytBody);
docBg.appendChild(mytb);
var va = document.getElementById("r25c10");
va.firstChild.nodeValue = "*";
va.style.backgroundColor="red";
enamy();
}
function enamy()
{
var r = Math.floor(Math.random()*20);
var c = Math.floor(Math.random()*20);
document.getElementById("r"+r+"c"+c).firstChild.nodeValue="@";
document.getElementById("r"+r+"c"+c).style.backgroundColor="#0000CC";
action();
}
function action()
{
//冲下来;
emove(1);
setTimeout("action();",1000);
}
function emove(n)
{
var y=getA("@");
var obj = document.getElementsByTagName("TD");
obj[y].firstChild.nodeValue="";
obj[y].style.backgroundColor="";
if(obj[y+n].firstChild.nodeValue=="*") {
alert("游戏失败拉");
if(confirm("继续不?")==true)
location.reload();
else
window.close();
}else{
obj[y+n].firstChild.nodeValue="@";
obj[y+n].style.backgroundColor="#0000CC";
}
}
function move(m)
{
var y = getA("*");
var obj = document.getElementsByTagName("TD");
obj[y].firstChild.nodeValue="";
obj[y].style.backgroundColor="";
obj[y+m].firstChild.nodeValue="*";
obj[y+m].style.backgroundColor="red";
}
function fight()
{
var y = getA("*");
var obj = document.getElementsByTagName("TD");
k=y-20;
for(var sp=25;sp>0;sp--) {
//if(sp<25)
// obj[k+20].style.backgroundColor='';
if(obj[k].firstChild.nodeValue=="@")
{
obj[k].style.fontSize='9pt';
obj[k].firstChild.nodeValue="www.zhaomu.com";
obj[k].style.backgroundColor="";
count++;
document.getElementById("result").innerHTML="你打死了"+count+"个怪物";
enamy();
break;
}
obj[k].style.backgroundColor='#ffcccc';
k-=20;
}
}
function getA(n)
{
var obj = document.getElementsByTagName("TD");
for(var y=0;y<obj.length;y++)
{
if(obj[y].firstChild.nodeValue==n)
{
return y;
}
}
}
document.οnkeydοwn=KeyDown;
//方向
function KeyDown(){
Key=event.keyCode
switch(Key){
case 37:move(-1);break//左
case 39:move(1);break//右
case 32:fight();break//上
default:break;
}
return false
}
function exti()
{
alert("游戏失败");
}
//-->
</script>
</HEAD>
<BODY οnlοad='start();'>
<div id="result"></div>
<a href="http://www.zhaomu.com">朝暮数据</a>
<br><br>
按空格键操作
</BODY>
</HTML>