Skip to main content
removeu 67 caracteres do conteúdo
Fonte Link
url 1
url 2
url 3
function link(x) {
var url = x.href;
var guia = window.open(url, '_blank');
guia.focus();
console.log(url) 
}
url 4 function link(x) { var url = x.href;

e no html:

var guia = window.open(url, '_blank');
<a href="http://google.com" onclick="link(this)">url 1 </a><br>
<a href="http://yahoo.com" onclick="link(this)">url 2 </a><br>
<a href="http://bing.com" onclick="link(this)">url 3 </a><br>
<a href="http://duckduckgo.com" onclick="link(this)">url 4 </a>
guia.focus(); console.log(url) }
url 1
url 2
url 3
url 4 function link(x) { var url = x.href; var guia = window.open(url, '_blank'); guia.focus(); console.log(url) }
function link(x) {
var url = x.href;
var guia = window.open(url, '_blank');
guia.focus();
console.log(url) 
}

e no html:

<a href="http://google.com" onclick="link(this)">url 1 </a><br>
<a href="http://yahoo.com" onclick="link(this)">url 2 </a><br>
<a href="http://bing.com" onclick="link(this)">url 3 </a><br>
<a href="http://duckduckgo.com" onclick="link(this)">url 4 </a>
Fonte Link

url 1
url 2
url 3
url 4 function link(x) { var url = x.href; var guia = window.open(url, '_blank'); guia.focus(); console.log(url) }