change href attribute with javascript code example
Example 1: javascript set attribute href
var a = document.getElementById('myElementID');
a.href = "http://www.mywebsite.com";
Example 2: javascript modify href attr
link.href = link.href + '?param1=' + input.value;