javascript setAttribute href code example
Example 1: javascript set attribute href
var a = document.getElementById('myElementID');
a.href = "http://www.mywebsite.com";
Example 2: set attribute javascript
Element.setAttribute(name, value);
var a = document.getElementById('myElementID');
a.href = "http://www.mywebsite.com";
Element.setAttribute(name, value);