布尔教育_Javascript基础_13 定时器
等风来Onclick:点击事件
Window.setTimeout(‘语句’,’毫秒’);指定毫秒执行一次语句,不属于js的知识他是属于Windows对象提供的功能
Windows.setInterval(‘语句’,’毫秒’);每经过毫秒执行语句;(反复执行)
//定时器
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<img src="./blue.png" alt="">
</body>
<script>
function time(){
var time = document.getElementsByTagName('img')[0];
time.src = './zi.png'
}
setTimeout('time()',3000);
</script>
</html>