<html>
<body>
<p>Click the button to create an A element with a link to w3schools.com.</p>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction() {
var x = document.createElement("A");
var t = document.createTextNode("Tutorials");
x.setAttribute("href", "../index.html");
x.appendChild(t);
document.body.appendChild(x);
}
</script>
</body>
<!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_anchor_create by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 05 Jun 2019 14:06:54 GMT -->
</html>