怎么查看网页源代码游戏源代码对玩游戏好处有哪些

《Javascript写的躲人游戏》 查看源代码
12:05:40 | 【
用鼠标按住拖动红色的方块,使得其在白色区域内移动, 注意千万不要撞到蓝色的方块,否则游戏结束, 在弹出对话框时,按住Ctrl+C,拷贝你的分数在网站上留言, 看看谁的分数最高,o(∩_∩)o...
&!DOCTYPE html PUBLIC &-//W3C//DTD XHTML 1.0 Transitional//EN& &http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&&
&html xmlns=&http://www.w3.org/1999/xhtml&&
&meta http-equiv=&Content-Type& content=&text/ charset=utf-8& /&
&title&Javascript写的躲人游戏
- 分享JavaScript-sharejs.com&/title&
&meta name=&Copyright& content=&JavaScript分享网 http://www.sharejs.com/& /&
&meta name=&description& content=&Javascript写的躲人游戏 ,JavaScript分享网& /&
&meta content=&JavaScript,分享,JavaScript代码,Ajax& name=&keywords& /&
&SCRIPT language=JavaScript type=text/javascript&
isNS4 = (document.layers) ? true :
isIE4 = (document.all && !document.getElementById) ? true :
isIE5 = (document.all && document.getElementById) ? true :
isNS6 = (!document.all && document.getElementById) ? true :
var curX, curY, curX2, curY2, boxX, boxY, moving=0, touch=0;
var gametime=0, started=0,
var starttime, endtime, finaltime=0; //pass finaltime to popup window to ask for initials
var enemyxdir = new Array(1,1,1,1);
var enemyydir = new Array(1,1,1,1);
if (isNS4 || isNS6){
document.captureEvents(Event.MOUSEUP|Event.MOUSEDOWN|Event.MOUSEMOVE);
document.onmousedown =
document.onmousemove = checkL
document.onmouseup =
function startclock() {var today = new Date(); starttime = today.getTime();}
function endclock() {var today = new Date(); endtime = today.getTime();}
function calctime() {var time = (endtime - starttime - 0)/1000; }
function giveposX(divname) {
if (isNS4) var posLeft = document.layers[divname].
else if (isIE4 || isIE5) var posLeft = document.all(divname).style.pixelL
else if (isNS6) var posLeft = parseInt(document.getElementById(divname).style.left + &&);
return posL
function giveposY(divname) {
if (isNS4) var posTop = document.layers[divname].
else if (isIE4 || isIE5) var posTop = document.all(divname).style.pixelT
else if (isNS6) var posTop = parseInt(document.getElementById(divname).style.top + &&);
return posT
function setposX(divname, xpos) {
if (isNS4) document.layers[divname].left =
else if (isIE4 || isIE5) document.all(divname).style.pixelLeft =
else if (isNS6) document.getElementById(divname).style.left =
function setposY(divname, ypos) {
if (isNS4) document.layers[divname].top =
else if (isIE4 || isIE5) document.all(divname).style.pixelTop =
else if (isNS6) document.getElementById(divname).style.top =
function givesize(divname, dimension) {
var divsize = 0;
if (dimension == 'y') {
if (isNS4) divsize = document.layers[divname].clip.
else if (isIE4 || isIE5) divsize = document.all(divname).style.pixelH
else if (isNS6) divsize = parseInt(document.getElementById(divname).style.height + &&);
else if (dimension == 'x') {
if (isNS4) divsize = document.layers[divname].clip.
else if (isIE4 || isIE5) divsize = document.all(divname).style.pixelW
else if (isNS6) divsize = parseInt(document.getElementById(divname).style.width + &&);
// check to see if 'box' is touching 'enemy1'
function checktouching(num) {
var enemy = &enemy& + num + &&
var difX = giveposX('box') - giveposX(enemy) - 0; // -0 converts to integer
var difY = giveposY('box') - giveposY(enemy) - 0;
// set touch = 1 if it is touching an enemy
if (difX & (-1 * givesize('box', 'x')) && difX & givesize(enemy, 'x') && difY & (-1 * givesize('box', 'y')) && difY & givesize(enemy, 'y')) {
touch = 1;
else touch = 0;
function movenemy(num,step_x,step_y){
var enemy = &enemy& + num + &&
var enemyx = givesize(enemy, 'x');
var enemyy = givesize(enemy, 'y');
if (giveposX(enemy) &= (450 - enemyx) || giveposX(enemy) &= 0) {
enemyxdir[num] = -1 * enemyxdir[num];
if (giveposY(enemy) &= (450 - enemyy) || giveposY(enemy) &= 0) {
enemyydir[num] = -1 * enemyydir[num];
var newposx = giveposX(enemy) + (step_x*enemyxdir[num]) + 0;
var newposy = giveposY(enemy) + (step_y*enemyydir[num]) + 0;
setposX(enemy, newposx);
setposY(enemy, newposy);
checktouching(num + &&);
if (touch == 1) {
stop(); reset();
function movenemies() {
gametime = gametime + 1
if (gametime &= 0 && gametime & 100) speed = 80;
else if (gametime &= 100 &&
gametime & 200) speed = 60;
else if (gametime &= 200 &&
gametime & 300) speed = 40;
else if (gametime &= 300 &&
gametime & 400) speed = 30;
else if (gametime &= 400 &&
gametime & 500) speed = 20;
else speed = 10;
// window.status = &speed:
& + speed + &
gametime: & +
movenemy(0,-10,12);
movenemy(1,-12,-20);
movenemy(2,15,-13);
movenemy(3,17,11);
setTimeout(movenemies,speed);
function start(e) {
if (started == 0) { movenemies();
startclock();
started = 1; }
curX = (isNS4 || isNS6) ? e.pageX : window.event.
curY = (isNS4 || isNS6) ? e.pageY : window.event.
curX2 = eval(curX - 40);
curY2 = eval(curY - 40);
boxX = eval(curX - 20);
boxY = eval(curY - 20);
var boxleft = giveposX('box');
var boxtop = giveposY('box');
if (curX & boxleft && curX2 & boxleft && curY & boxtop && curY2 & boxtop) {
moving = 1;
setposX('box', boxX);
setposY('box', boxY);
if (isNS4 || isNS6){
document.captureEvents(Event.MOUSEMOVE);
function stop(e){
if (isNS4 || isNS6){
document.releaseEvents(Event.MOUSEMOVE);
function reset(e){
endclock();
if (isNS4 || isNS6){
document.releaseEvents(Event.MOUSEMOVE);
if (finaltime == 0) {
finaltime = calctime();
window.alert('You hold ' + finaltime + ' seconds... salutations Fp');
var entername = window.confirm('Enter your name?');
if (entername) {
window.open(&?& + finaltime,'winwin','width=300,height=500,left=40,top=40,status=1,resizable');
document.location.reload();
else document.location.reload();
document.location.reload();
function checkLocation(e){
curX = (isNS4 || isNS6) ? e.pageX : window.event.
curY = (isNS4 || isNS6) ? e.pageY : window.event.
boxX = eval(curX - 20);
boxY = eval(curY - 20);
checktouching('1');
if (moving == 1 && touch == 0){
setposX('box',boxX);
setposY('box',boxY);
if (curY & 69 && curX & 69 && curY & 381 && curX & 381)
else stop(); reset();
else if (touch == 1){
stop(); reset();
&BODY text=#000000 bgColor=#ffffff leftMargin=0 topMargin=0 marginwidth=&0&
marginheight=&0&&
&DIV id=box
style=&LEFT: 205 WIDTH: 40 POSITION: TOP: 205 HEIGHT: 40 BACKGROUND-COLOR: #990000; layer-background-color: #990000&&
&TABLE height=40 width=40&
&TD&&&/TD&&/TD&&/TR&&/TBODY&&/TABLE&&/DIV&
&DIV id=enemy0
style=&LEFT: 270 WIDTH: 60 POSITION: TOP: 60 HEIGHT: 50 BACKGROUND-COLOR: #000099; layer-background-color: #000099&&
&TABLE height=50 width=60&
&TD&&&/TD&&/TR&&/TBODY&&/TABLE&&/DIV&
&DIV id=enemy1
style=&LEFT: 300 WIDTH: 100 POSITION: TOP: 330 HEIGHT: 20 BACKGROUND-COLOR: #000099; layer-background-color: #000099&&
&TABLE height=20 width=100&
&TD&&&/TD&&/TR&&/TBODY&&/TABLE&&/DIV&
&DIV id=enemy2
style=&LEFT: 70 WIDTH: 30 POSITION: TOP: 320 HEIGHT: 60 BACKGROUND-COLOR: #000099; layer-background-color: #000099&&
&TABLE height=60 width=30&
&TD&&&/TD&&/TR&&/TBODY&&/TABLE&&/DIV&
&DIV id=enemy3
style=&LEFT: 70 WIDTH: 60 POSITION: TOP: 70 HEIGHT: 60 BACKGROUND-COLOR: #000099; layer-background-color: #000099&&
&TABLE height=60 width=60&
&TD&&&/TD&&/TR&&/TBODY&&/TABLE&&/DIV&
&TABLE cellSpacing=0 cellPadding=0 border=0&&!-- row 1 --&
&TD width=50 bgColor=#000000 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 bgColor=#000000 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 bgColor=#000000 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 bgColor=#000000 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 bgColor=#000000 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 bgColor=#000000 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 bgColor=#000000 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 bgColor=#000000 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 bgColor=#000000 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&&/TR&&!-- row 2 --&
&TD width=50 bgColor=#000000 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 bgColor=#000000 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&&/TR&&!-- row 3 --&
&TD width=50 bgColor=#000000 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 bgColor=#000000 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&&/TR&&!-- row 4 --&
&TD width=50 bgColor=#000000 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 bgColor=#000000 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&&/TR&&!-- row 5 --&
&TD width=50 bgColor=#000000 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 bgColor=#000000 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&&/TR&&!-- row 6 --&
&TD width=50 bgColor=#000000 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 bgColor=#000000 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&&/TR&&!-- row 7 --&
&TD width=50 bgColor=#000000 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 bgColor=#000000 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&&/TR&&!-- row 8 --&
&TD width=50 bgColor=#000000 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 bgColor=#000000 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&&/TR&&!-- row 9 --&
&TD width=50 bgColor=#000000 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 bgColor=#000000 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 bgColor=#000000 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 bgColor=#000000 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 bgColor=#000000 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 bgColor=#000000 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 bgColor=#000000 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 bgColor=#000000 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&
&TD width=50 bgColor=#000000 height=50&
&TD&&/TD&&/TR&&/TBODY&&/TABLE&&/TD&&/TR&&/TBODY&&/TABLE&
&font face=&verdana,arial,helvetica& size=&2&&
&BR&&&/font&&div style=&position: width: 285 height: 293 z-index: 1; left: 467 top: 32px& id=&layer1&&
Click onto the red block with jump over it:&br&
Move the red block avoiding crash with the blue ones&br&
Don't touch the black edge.&br&
If you can reach more than 18 seconds, you are a genius.&br&
It is said that the pilots from the US Air Force&br&
are forced to reach 2 MINUTES.&/div&
&div align=¢er&&
获取更多JavaScript代码,请登录JavaScript分享网 &a href=&http://www.sharejs.com&&http://www.sharejs.com&/a&
点击:24213&&&&
点击:18798&&&&
点击:11837&&&&
点击:12109&&&&
点击:9640&&&&
点击:8157&&&&
点击:8417&&&&
点击:14493&&&&
点击:7739&&&&
点击:24409&&&&
点击:24213&&&&
点击:24409&&&&
点击:23287&&&&
点击:18798&&&&
点击:17721&&&&
点击:14493&&&&
点击:16404&&&&
点击:14143&&&&
点击:11837&&&&
点击:12846&&&&
合作网站:

参考资料

 

随机推荐