JavaScript is not very strict programming language. Which means, you can declare variables and assign any value to them such as a string, an integer, a float etc.
the following script demonstrates how you can change the value of the href of a link from google.com to codingforums.com
Code:
<html>
<head>
<title>Test</title>
<script>
function change( ref ) {
ref.href = "http://codingforums.com";
return true;
} //-- ends
</script>
</head>
<body>
<a href="http://google.com" onclick="return change(this);">google</a>
</body>
</html>
There are other ways to do this, but I am sure that you can use your imagination.
Good Luck
Ess