2017-12-09 5 views
0

죄송합니다. 멍청한 멍청한 질문이라면 죄송 합니다만, Chrome에서로드 한 후이 페이지에서 마우스를 한 번 클릭하지 않고 새 페이지로 연결되는 이유를 이해할 수 없습니다. 나는 다른 페이지를 얻기 위해 Google 링크를 클릭하도록 노력하고 있습니다 ... 감사합니다!클릭없이 링크 리디렉션

<!DOCTYPE html> 
<html> 
<head> 

</head> 
<body> 
<h1>3 JS</h1> 
<a id="googlelink" href="https://www.google.com">Google</a> 
<hr> 
<a href="https://www.google.com">Google</a> 
<hr> 
</body> 
</html> 

<script> 
document.getElementById("googlelink").addEventListener("click", redirectToYahoo()); 
document.getElementById("googlelink").addEventListener("auxclick", redirectToYahooNewTab()); 

function redirectToYahoo() { 
    window.location.href = "https://www.yahoo.com"; 
    } 

function redirectToYahooNewTab() { 
    window.open('https://www.yahoo.com', '_blank'); 
} 

</script> 
+0

HTML이 잘못되었습니다. '