<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>案例2</title>
</head>
<body>
    <!--
        321跳转百度
            innerHtml : 可以识别标签
            innerText : 直接翻译成文本
            1. 获取h1标签
            2. 改变 内容 每个1秒
            3. 定时器 setTimeout
    -->
    <h1 id="h1" ></h1>
    <script>
        //开启定时器 返回值关闭
        let count = 1;
        let index = setInterval(function (){
            if (count == 3){
                clearInterval(index)
                //改变地址
                location.href = "https://www.baidu.com"
            }
            //业务逻辑
            let h1 = document.getElementById("h1");

            //h1添加内容
            //h1.innerHTML = "<font color='red'>"+(4-count)+"</font>";
            h1.innerText = "<font color='red'>"+(4-count)+"</font>";
            //改变标识
            count++;

        },1000);

    </script>
</body>
</html>