<body>
<a href="/go.html?url=https://www.baidu.com">www.baidu.com</a>
</body>
<script>
var a = document.querySelector("a");
var isFirst = true;
a.addEventListener("click", function(){
if (isFirst) {
// cancelable表示事件是否可以取消默认行为,这是在事件 对象 在创建的时候就已经决定的
if (event.cancelable) {
// preventDefault是事件对象的方法,用来取消事件的默认行为
// 另外一个与其相关的状态是 defaultPreventd 用来获取事件有没有被取消过默认行为
event.preventDefault();
// location.href = "https://www.hnqingyun.com";
window.open("https://www.google.com");
}
isFirst = false;
}
});
</script><body>
<a href="/go.html?url=https://www.bai