* setInterval clearInterval * 用法

代码
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>runcode</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="Author" content="Sheneyan" />
<script language="javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.min.js"></script>
<script type="text/javascript">

/**
 *  时钟
 *  setInterval clearInterval
 *  用法
 *
*/

    
var i;
    $(document).ready(
function() {
     i
= setInterval(updateSeconds, 10); 
    });

    
function updateSeconds() {
        
var divs = new Date();
        
if (divs.getSeconds() == 0) {
            clearInterval(i);
        }
        jQuery(
"#timediv").html(divs.getHours() +" "+ divs.getMinutes() +" "+ divs.getSeconds());

    }
</script>
</head>
<body>
<div id="timediv"></div> 
</body>
</html>


原文地址:https://www.cnblogs.com/jacd/p/1757760.html