document.getElementById("foo").href="newPage.php";
<!DOCTYPE HTML>
<html>
<body>
<a id="myLinkId" href="abc.com" >Auto update href</a>
<script>
var findlink = document.getElementById("myLinkId");
findlink.href = "xyz.com";
</script>
</html>