There is a list of links with the type = "popup" attribute.

document.querySelector("[type=popup]").onclick = function() { window.open("this.href", "_blank", "width=600,height=600"); return false } 
  <a type="popup" href="https://www.google.ru/">Google</a> <a type="popup" href="https://www.yandex.ru/">Яндекс</a> 

After clicking, you need to open links in a new window.

What did I do:

 document.querySelector("[type=popup]").onclick = function() { window.open("this.href", "_blank", "width=600,height=600"); return false } 

The window opens, but the link is missing, ie the link is this.href.

How to open a link in a new window?

    2 answers 2

     document.querySelector("[type=popup]").onclick = function(e) { window.open(e.target.href, "_blank", "width=600,height=600"); return false } 
    • For the list of links does not work, only the first opens with querySelectorAll does not help. - Viher

    List of links wrapped in class. Object passed to selector. All items open in a new window.

     <div class="♥"> <a href="https://www.google.ru/">Google</a> <a href="https://www.yandex.ru/">Яндекс</a> </div> <script> var listHref = document.getElementsByClassName('♥'); listHref = document.querySelector("*").onclick = function(e) { window.open(e.target.href, "_blank", "width=600,height=600"); return false } </script>