<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>定时器的基本用法</title>
<script type="text/javascript">
var timer = setTimeout(function(){
alert('hello');
}, 3000);
clearTimeout(timer);
var timer2 = setInterval(function(){
alert('heihei');
}, 2000);
clearInterval(timer2);
</script>
</head>
<body>
</body>
</html>