document.getElementById("Element").href = "http://example.com/";
<a href="#" onclick="myJsFunc();">Run JavaScript Code</a>