<!DOCTYPE html>
<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", "http://www.w3ii.com");
x.appendChild(t);
document.body.appendChild(x);
}
</script>
</body>
</html>