zoukankan      html  css  js  c++  java
  • 有趣的JavaScript小程序

     1 <!doctype html>
     2 <html lang="en">
     3  <head>
     4   <meta charset="UTF-8">
     5   <meta name="Generator" content="EditPlus®">
     6   <meta name="Author" content="">
     7   <meta name="Keywords" content="">
     8   <meta name="Description" content="">
     9   <title>倒计时</title>
    10  </head>
    11 
    12 <script type="text/javascript">
    13 <!--
    14     h= 0
    15     m= 0
    16     s= 30
    17     
    18     function cal()
    19     {
    20          --s
    21           if (s < 0)
    22           {
    23               --m
    24               s= 59
    25            }
    26           if (m < 0)
    27           {
    28               --h
    29               m= 59
    30           }
    31         if(h>=0)    document.aa.t1.value= h+": "+m+": "+s
    32         else    {
    33             alert("考试结束,恭喜你撑到了最后!")
    34             num= 8
    35             s= "Do you want to anymore? 
        "
    36             hehe= "0.0 "
    37             haha= "~.~ "
    38             for(i=1; i<=num; ++i) {
    39                 str= s
    40                 for(j=1; j<=i; ++j)        str= str+ ( Math.random( )< 0.5 ? hehe: haha )
    41                 alert ( str )
    42             }
    43             return
    44         }
    45         setTimeout("cal()",200)
    46     }
    47 //-->
    48 </script>
    49 
    50  <body bgcolor= #33ffff>
    51         <form name="aa">
    52             距离考试结束还剩下:
    53             <input type=text name="t1">
    54         </form>
    55         <SCRIPT LANGUAGE="JavaScript">
    56             <!--
    57             cal()
    58             //-->
    59         </SCRIPT>
    60  </body>
    61 </html>
  • 相关阅读:
    java网络爬虫爬虫小栗子
    浮点数精确表示
    使用yum安装CDH Hadoop集群
    判断奇数,java陷阱
    Long型整数,缄默溢出
    java基础知识点
    java常用指令
    Codeforces Round #275 (Div. 2) D
    区间dp的感悟
    Codeforces Round #386 (Div. 2) C D E G
  • 原文地址:https://www.cnblogs.com/Newdawn/p/4396312.html
Copyright © 2011-2022 走看看