1 2 3 <meta charset= "Utf-8" >4 <title> Timing Warning </title>5 6 <body>7 <!--Timing warning issues--8 9 <input type= "button" value= "timing Warning" onclick= "settimemsg ()"/>Ten <script language= "JavaScript" >11functionSettimemsg () {SetTimeout (' Alert ' ("Hello World!!!") ', 3000);//3s13}</script><!--counters--<input type= "button" value= "Start timing" onclick= "startTime ()"/><input type= "text" id= "num"/><br><input type= "button" value= "End Timing" onclick= "stoptime ()"/>21st<script language= "JavaScript" >23var i=0;24VarT25functionStartTime () {document.getElementById ("num"). value=i; I=i+1; T=settimeout ("StartTime ()", 10); //1s } function stoptime () { cleartimeout (t); </script> </body>pns
1 2 3 <meta charset= "Utf-8" >4 <title> Timing Warning </title>5 6 <body onload= "StartTime ()" >7 8 <script language= "JavaScript" >9functionStartTime () {10var date=NewDate ();11var year=Date.getfullyear ();12var month=date.getmonth () +1;13var day=Date.getdate ();14var hour=Date.gethours ();15var minute=Date.getminutes (); var second=date.getseconds (); / /var str=year+ "year" +month+ "month" +day+ "Day" +hour+ ":" +minute+ ":" +second; var str=hour+ ":" +minute+ ":" +second; document.getElementById ("Time"). innerhtml=str; SetTimeout ("StartTime ()", +); </script></body>
JavaScript implements counters, timed warnings and stops