HTML super simple timer

When work did not find windows timer, so he used to write a JS.

In fact, not as a download faster, but I have finished, others quickly copy the download function in general, and occasionally updates, in addition to the timing can not do anything.

Timer page as follows, and then allowed to insert js function can not be used temporarily, you can copy the code into your document.

Please input timing: hour minute S

 

 

Source code is:

<!DOCTYPE html>
<html>
<head>
    <title>计时器</title>
    <style type="text/css">
        input{width: 50px;}
    </style>
    <script type="text/javascript">
        function oldtime(argument) {
            var oldTime1=new Date();
            var H=oldTime1.getHours();
            var M=oldTime1.getMinutes();
            var S=oldTime1.getSeconds();
            var Shour=document.getElementById('hour').value;
            var Smin=document.getElementById('min').value;
            var ssec = document.getElementById ( 'sec' ) .Value;
             var Time = (Shour * 60 * 60 * 60 + + Smin of ssec) * 1000 ;
             function tishi () { 
                Alert ( "timing has to you, you set regular time "+ Shour +" h "+ Smin +" min "+ ssec +" seconds, the time start timing is "+ H +": "+ M +": "+ S); 
            } 
            the setTimeout (tishi, time); 
            
        }
     </ Script> 
</ head> 
<body> 
    Please input timing:
     <input type = "num" name = "" placeholder = " 0" ID = "hour"> h
     <input type = "num" name = "" placeholder = " 0 "id =" min ">分钟
    <input type="num" name=""  placeholder="0" id="sec"><input type="submit" name="" value="提交" onclick="oldtime();">
</body>
</html>

 

Guess you like

Origin www.cnblogs.com/jiry/p/11447290.html