xxxxxxxxxx
var example = "ww.google.com";
var exampleHref = "http://" + google;
// get some parent div with id
var div = document.getElementById('someDiv');
// create <a> tag
var tag = document.createElement(a);
// set the href attribute
tag.setAttribute('href', exampleHref);
// append the node to the parent
div.appendChild(tag);