程序员做起

消消乐
1.html
 
 
 
 

翻牌倒计时:

 
   
 
 
 
 
 
    var row=4;
var low=4;
var sum=row*low;
    var str="";
var myarray=new Array();
var lastNum=0;
var currNum=0;
for(var k=0;k
   myarray[k+sum/2]=myarray[k]=parseInt(Math.random()*4)+1;
}
myarray.sort(function() {return Math.random()>.5;});
for(var i=0;i
str+="";
  for(var j=0;j
  str+="
  str+='';
  str+="";
  }
str+="
";
}
document.write(str);
//for(var k=1;k<=sum;k++){
  // document.getElementById_x("numTd_"+k).innerHTML=myarray[k-1];
//}
 
 
 
2.html
 
 
 
 

翻牌倒计时:

 
   
 
 
 
 
    var row=6;
var low=6;
var sum=row*low;
    var str="";
var myarray=new Array();
var lastNum=0;
var currNum=0;
for(var k=0;k
   myarray[k+sum/2]=myarray[k]=parseInt(Math.random()*6)+1;
}
myarray.sort(function() {return Math.random()>.5;});
for(var i=0;i
str+="";
  for(var j=0;j
  str+="
  str+='';
  str+="";
  }
str+="
";
}
document.write(str);
//for(var k=1;k<=sum;k++){
  // document.getElementById_x("numTd_"+k).innerHTML=myarray[k-1];
//}
 
 
main.js
 
 
 
 

翻牌倒计时:

 
   
 
 
 
 
    var row=6;
var low=6;
var sum=row*low;
    var str="";
var myarray=new Array();
var lastNum=0;
var currNum=0;
for(var k=0;k
   myarray[k+sum/2]=myarray[k]=parseInt(Math.random()*6)+1;
}
myarray.sort(function() {return Math.random()>.5;});
for(var i=0;i
str+="";
  for(var j=0;j
  str+="
  str+='';
  str+="";
  }
str+="
";
}
document.write(str);
//for(var k=1;k<=sum;k++){
  // document.getElementById_x("numTd_"+k).innerHTML=myarray[k-1];
//}
 
 
2.main.js
// JavaScript Document
 var used=new Array();
 var count=0;
 var row=6;
var low=6;
var sum=row*low;
   for(var k=1;k<=sum;k++){
      used[k]=false;
   }
   function Judge(k){
   if(used[k]) return;
   lastNum=currNum;
   currNum=k;
   used[k]=true;
   //for(var k=1;k<=sum;k++){
   var temp=document.getElementById_x("img"+k);
   temp.src="photo/image"+myarray[k-1]+".GIF";
  //}
  if(lastNum==0) return;
  if(myarray[lastNum-1]==myarray[currNum-1]){
   //;
   lastNum=currNum=0;
   //count+=count;
   
   count++;
   
   //;
   if(count==18){
   ;
    window.location.href="file:///C:/Users/Administrator/Desktop/fp/index.html";
   return count;
   }
  }
  else{
   //;
   temp=document.getElementById_x("img"+lastNum);
   temp.src="photo/image0.GIF";
   used[lastNum]=false;
  }
   }
time.js
// JavaScript Document
//倒计时
var mytime=20;
var minute;
var secound;
var str1;
//var num=1;
var d = new Date(); //Date对象
function setTime()//
{
//;
//mytime--;
//myinter=setTimeout("setTime()",1000);
minute=Math.floor(mytime/60);
secoud=mytime`;
str1=String(minute+100).substr(1,2)+":"+String(secoud+100).substr(1,2);
document.getElementById_x("time").innerHTML=str1;
//document.getElementById_x("time").innerHTML=GetTimeString(mytime);
mytime--;
if(mytime<0)
{
clearInterval(myinter);
;
clearTimeout(myinter);
var msg="您是否要继续?\n\n请确认!"
if(confirm(msg)==true){
  window.location.href="1.html";
}
else{
  window.location.href="index.html";
}
}
}
var myinter=setInterval(setTime,1000);
//进度条
 function run(){  
        var bar = document.getElementById_x("bar"); 
        var total = document.getElementById_x("total"); 
    bar.style.width=parseInt(bar.style.width) + 1 + "%";  
    total.innerHTML = bar.style.width; 
    if(bar.style.width == "100%"){  
      window.clearTimeout(timeout); 
      return; 
    } 
    var timeout=window.setTimeout("run()",200); 
  } 
    window.onload = function(){  
       run(); 
    }  
// function GetTimeString(time){//格式化时间
     //d.setHours(0,0,time)
     //return d.toLocaleTimeString() //格式化输出
   //}



 
";
";
";

posted on 2018-11-09 20:14  王冰涛涛涛涛  阅读(161)  评论(0编辑  收藏  举报