Edit This Code:
<!DOCTYPE html>
<html>
<hea<!--d>
<base id="myBase" href="http://www.w3schools.com/jsref/">-->

</head
>

<body>

<p>Click the button to set the value of the target attribute of ALL links on a page to "_blank".</p>

<p><a href="../index.html">W3Schools</a></p>
<p><a href="../index.html">W3Schools</a></p>

<p><b>Note:</b> Try the links before and after you have clicked the button!</p>

<button onclick="myFunction()">Try it</button>

<p id="demo"></p>

<script>
function myFunction() {
    document.getElementById("myBase").target = "_blank";
    document.getElementById("demo").innerHTML = "The value of the target attribute was set.";
}
</script>

</body>
</html>


Result:
Try it Yourself - © w3schools.com
Privacy Policy