⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 newpage7.htm

📁 javascript源码集锦
💻 HTM
字号:
<!-- This script has been in the http://www.javascripts.com Javascript Public Library! -->
<!-- Note that though this material may have been in a public depository, certain author copyright restrictions may apply. -->
<html>

<head>
<title>Bash</title>
</head>

<body>
<script LANGUAGE="JavaScript">
counter=30;
temp=0;
counthit=0;
hit=0;
current=0;
position=0;
flash=0;

function gametimer()
{
      counter--;
      if(counter>=0)
      {
         if(counter>9)
            document.keepscore.timer.value='00:'+counter;
         else
            document.keepscore.timer.value='00:0'+counter;
        timer=setTimeout("gametimer()",1500);
      }
      else
         stopgame();
      if(counter==0)
      {
         clearTimeout(randbutton);
         document.field.reset();
      }
}

function playgame()
{  
      random=(Math.floor(Math.random()*100%36));
      if(isNaN(random)||random>36)
         random=10;
      document.field.elements[temp].checked=false;
      document.field.elements[random].checked=true;
      current=random;
      temp=random;
      counthit++;
      randbutton=setTimeout("playgame()",1000);
}

function stopgame()
{
      clearTimeout(timer);
      clearTimeout(randbutton);
      counthit=counthit-1;
      if(document.keepscore.score.value>=counthit)
      {
         alert('CONGRATULATIONS! PERFECT SCORE!\n\nYou hit '+document.keepscore.score.value+' targets out of '+counthit+' possible targets!\nThats ' +Math.ceil((document.keepscore.score.value/counthit)*100)+'% accuracy!');
         perfect();
      }
      else
         alert('Time Up!\n\nYou hit '+document.keepscore.score.value+' targets out of '+counthit+' possible targets.\nHit Percentage: '+Math.ceil((document.keepscore.score.value/counthit)*100)+'%');
      document.field.reset();
      document.keepscore.reset();
      valu=0;
      counter=30;
      count=0;
      counthit=0;
      hit=0;
      temp=0;
}

function check(position)
{
   if(position-1==current)
      hit++;
   else
      document.field.elements[position].checked=false;

   document.keepscore.score.value=hit;
}

function perfect()
{
   intrvl=0;
   for(var x=0;x<=10;x++)
   {
      intrvl += 100;
      setTimeout("document.bgColor='blue';",intrvl);
      intrvl += 100;
      setTimeout("document.bgColor='yellow';",intrvl);
      intrvl += 100;
      setTimeout("document.bgColor='green';",intrvl);
      intrvl += 100;
      setTimeout("document.bgColor='red';",intrvl);
      intrvl += 100;
      setTimeout("document.bgColor='purple';",intrvl);
      intrvl += 100;
      setTimeout("document.bgColor='orange';",intrvl);
      intrvl += 100;
      setTimeout("document.bgColor='white';",intrvl);
   }
}

</script>


<form NAME="keepscore">
  <table CELLPADDING="0" CELLSPACING="0" BORDER="0" VALIGN="bottom">
    <tr>
      <td>Time</td>
      <td>Score</td>
    </tr>
    <tr>
      <td><input TYPE="text" VALUE="00:30" NAME="timer" SIZE="5"></td>
      <td><input TYPE="text" VALUE="0" NAME="score" SIZE="5"></td>
    </tr>
  </table>
</form>
<!--------------------------------- CREATE THE PLAYING FIELD --------------------------->

<form NAME="field">
  <table CELLPADDING="0" CELLSPACING="0" BORDER="1" VALIGN="top">
    <tr>
      <td><table CELLPADDING="0" CELLSPACING="3" BORDER="0">
        <script LANGUAGE="JavaScript">
count=0;
for(var x=0; x<=5; x++)
{
   document.write('<TR>');
   for(var y=0; y<=5; y++)
   {
      count++;
      document.write('<TD><INPUT TYPE="radio" ONCLICK="check('+count+')"></TD>');
   }
   document.writeln('</TR>');
}
</script>

      </table>
      </td>
    </tr>
  </table>
<!------------------------------- PLAYING FIELD FINSHED -------------------------------->
  <p><input TYPE="button" VALUE="Start" NAME="start" ONCLICK="playgame();gametimer()"><input
  TYPE="button" VALUE="Stop" NAME="stop" ONCLICK="stopgame()"> </p>
</form>

<p align="center">Hit the targets as many times as you can, should you get a perfect score 
you get a cool background effect. You have 30 seconds and when time is up you are shown 
how many targets you hit out of the possible targets along with your hit percentage. <br>
<b>Ryan Gilfether <a href="hotrodder@rocketmail.com">hotrodder@rocketmail.com</a></b> </p>
</body>
</html>
<!-- Simba says Roar. -->

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -