Give the <a> an ID, and then you can do whatever you want with it's properties 
Example:
Code:
<html>
<head>
<script language="javascript">
var id = 0;
function changeurl()
{
var link = document.getElementById("mylink");
var href = link.href;
var pos = href.indexOf("ID=") + 3;
href = href.substr(0, pos) + id;
link.href = href;
if(confirm("The href is now:\n" + href + "\n\nContinue?"))
{
id = ++id % 10;
setTimeout("changeurl()", 1000);
}
}
</script>
</head>
<body onload="changeurl();">
<a id="mylink" href="http://www.fakeurl.com/somepage.php?ID=">Hi, I'm the link</a>
</body>
</html>
Bookmarks