2.8 链接重定向

<a id="a" href="https://www.baidu.com">搜索</a>

<script>
    document.getElementById("a").onclick = function () {
        window.location = "https://www.google.com"; // 修改 window 页面
        return false;// 不触发 a 元素的 href 默认事件
    }
</script>