网页特效代码其他特效网页游戏特效代码 测试反应速度特效Word文档格式.docx
《网页特效代码其他特效网页游戏特效代码 测试反应速度特效Word文档格式.docx》由会员分享,可在线阅读,更多相关《网页特效代码其他特效网页游戏特效代码 测试反应速度特效Word文档格式.docx(23页珍藏版)》请在冰豆网上搜索。
document.getElementById)?
isNS6=(!
document.all&
varcurX,curY,curX2,curY2,boxX,boxY,moving=0,touch=0;
vargametime=0,started=0,speed;
varstarttime,endtime,finaltime=0;
//passfinaltimetopopupwindowtoaskforinitials
varenemyxdir=newArray(1,1,1,1);
varenemyydir=newArray(1,1,1,1);
if(isNS4||isNS6){
document.captureEvents(Event.MOUSEUP|Event.MOUSEDOWN|Event.MOUSEMOVE);
}
document.onmousedown=start;
document.onmousemove=checkLocation;
document.onmouseup=stop;
functionstartclock(){vartoday=newDate();
starttime=today.getTime();
functionendclock(){vartoday=newDate();
endtime=today.getTime();
functioncalctime(){vartime=(endtime-starttime-0)/1000;
returntime;
functiongiveposX(divname){
if(isNS4)varposLeft=document.layers[divname].left;
elseif(isIE4||isIE5)varposLeft=document.all(divname).style.pixelLeft;
elseif(isNS6)varposLeft=parseInt(document.getElementById(divname).style.left+"
"
);
returnposLeft;
functiongiveposY(divname){
if(isNS4)varposTop=document.layers[divname].top;
elseif(isIE4||isIE5)varposTop=document.all(divname).style.pixelTop;
elseif(isNS6)varposTop=parseInt(document.getElementById(divname).style.top+"
returnposTop;
functionsetposX(divname,xpos){
if(isNS4)document.layers[divname].left=xpos;
elseif(isIE4||isIE5)document.all(divname).style.pixelLeft=xpos;
elseif(isNS6)document.getElementById(divname).style.left=xpos;
functionsetposY(divname,ypos){
if(isNS4)document.layers[divname].top=ypos;
elseif(isIE4||isIE5)document.all(divname).style.pixelTop=ypos;
elseif(isNS6)document.getElementById(divname).style.top=ypos;
functiongivesize(divname,dimension){
vardivsize=0;
if(dimension=='
y'
){
if(isNS4)divsize=document.layers[divname].clip.height;
elseif(isIE4||isIE5)divsize=document.all(divname).style.pixelHeight;
elseif(isNS6)divsize=parseInt(document.getElementById(divname).style.height+"
elseif(dimension=='
x'
if(isNS4)divsize=document.layers[divname].clip.width;
elseif(isIE4||isIE5)divsize=document.all(divname).style.pixelWidth;
elseif(isNS6)divsize=parseInt(document.getElementById(divname).style.width+"
returndivsize;
//checktoseeif'
box'
istouching'
enemy1'
functionchecktouching(num){
varenemy="
enemy"
+num+"
vardifX=giveposX('
)-giveposX(enemy)-0;
//-0convertstointeger
vardifY=giveposY('
)-giveposY(enemy)-0;
//settouch=1ifitistouchinganenemy
if(difX>
(-1*givesize('
'
))&
difX<
givesize(enemy,'
)&
difY>
difY<
)){
touch=1;
elsetouch=0;
functionmovenemy(num,step_x,step_y){
varenemyx=givesize(enemy,'
varenemyy=givesize(enemy,'
if(giveposX(enemy)>
=(450-enemyx)||giveposX(enemy)<
=0){
enemyxdir[num]=-1*enemyxdir[num];
if(giveposY(enemy)>
=(450-enemyy)||giveposY(enemy)<
enemyydir[num]=-1*enemyydir[num];
varnewposx=giveposX(enemy)+(step_x*enemyxdir[num])+0;
varnewposy=giveposY(enemy)+(step_y*enemyydir[num])+0;
setposX(enemy,newposx);
setposY(enemy,newposy);
checktouching(num+"
if(touch==1){
stop();
reset();
functionmovenemies(){
gametime=gametime+1
if(gametime>
=0&
gametime<
100)speed=80;
elseif(gametime>
=100&
200)speed=60;
=200&
300)speed=40;
=300&
400)speed=30;
=400&
500)speed=20;
elsespeed=10;
//window.status="
speed:
"
+speed+"
gametime:
+gametime;
movenemy(0,-10,12);
movenemy(1,-12,-20);
movenemy(2,15,-13);
movenemy(3,17,11);
setTimeout(movenemies,speed);
functionstart(e){
if(started==0){movenemies();
startclock();
started=1;
}
curX=(isNS4||isNS6)?
e.pageX:
window.event.x;
curY=(isNS4||isNS6)?
e.pageY:
window.event.y;
curX2=eval(curX-40);
curY2=eval(curY-40);
boxX=eval(curX-20);
boxY=eval(curY-20);
varboxleft=giveposX('
varboxtop=giveposY('
if(curX>
boxleft&
curX2<
curY>
boxtop&
curY2<
boxtop){
moving=1;
setposX('
boxX);
setposY('
boxY);
document.captureEvents(Event.MOUSEMOVE);
functionstop(e){
moving=0;
document.releaseEvents(Event.MOUSEMOVE);
functionreset(e){
endclock();
if(finaltime==0){
finaltime=calctime();
window.alert('
你堅持了'
+finaltime+'
秒…'
//varentername=window.confirm('
Enteryourname?
'
//if(entername){
//window.open("
?
+finaltime,'
winwin'
'
width=300,height=500,left=40,top=40,status=1,resizable'
//document.location.reload();
//}
//elsedocument.location.reload();
document.location.reload();
functioncheckLocation(e){
checktouching('
1'
if(moving==1&
touch==0){
boxX);
boxY);
if(curY>
69&
curX>
curY<
381&
curX<
381)returnfalse;
elsestop();
elseif(touch==1){
/SCRIPT>
METAcontent="
MSHTML6.00.2900.5512"
name=GENERATOR>
styletype="
text/css"
--
.style1{color:
#ECE9D8}
.style10{color:
#FF6600}
.style4{font-size:
12;
color:
#333333;
.style9{color:
#669966;
font-size:
12px;
.style2{font-weight:
bold}
.style3{font-size:
14px}
.style5{font-size:
16px}
-->
/style>
/HEAD>
BODYtext=#000000bgColor=#ffffffleftMargin=0topMargin=0marginheight="
0"
marginwidth="
DIVid=box
style="
LEFT:
205px;
WIDTH:
40px;
POSITION:
absolute;
TOP:
HEIGHT:
BACKGROUND-COLOR:
#990000;
layer-background-color:
#990000"
TABLEheight=30width=30>
TBODY>
TR>
TD>
<
/TD>
/TR>
/TBODY>
/TABLE>
/DIV>
DIVid=enemy0
270px;
60px;
50px;
#000099;
#000099"
TABLEheight=50width=60>
DIVid=enemy1
300px;
100px;
330px;
20px;
TABLEheight=20width=100>
DIVid=enemy2
70px;
30px;
320px;
TABLEheight=60width=30>
DIVid=enemy3
67px;
TABLEheight=60width=60>
TABLEcellSpacing=0cellPadding=0border=0>
--row1-->
TRbgcolor="
#333333"
TDwidth=50height=50bgColor=#333333>
TABLE>
TDclass="
style1"
TDwidth=50height=50>
--row2-->
TDwidth=50bgColor=#333333height=50>
--row3-->
TAB