Question : get value of link using javascript

I have these two links:

<div class="leave"><a href="http://www.google.com">Leave to Google</a></div>
<div class="leave"><a href="http://www.yahoo.com">Leave to Yahoo</a></div>

When the user leaves the page this function fires:

<script>
function Redirect() {
var where="colorbox_autofire.html";
window.location=where;
}
</script>

through the body onUnLoad:
<body onUnLoad="Redirect()">
Before the user is redirected I want to get the href value of the link they clicked and store it in a variable. How would I do this?

Thanks

Answer : get value of link using javascript

I'm not sure what the redirection to colorbox_autofire.html is supposed to do, but if I ignore that piece for now, how about something like this:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
<div class="leave"><a href="Javascript:;" onClick="Redirect('http://www.google.com')">Leave to Google</a></div>
<div class="leave"><a href="Javascript:;" onClick="Redirect('http://www.yahoo.com')">Leave to Yahoo</a></div>

<script language="JavaScript">
<!--
function Redirect(myLocation) {
//   var where = "colorbox_autofire.html";
//   window.location=where;

// myLocation is a variable that now has the link that was clicked.
   alert(myLocation);
   window.location = myLocation;
}
//-->
</script>
Random Solutions  
 
programming4us programming4us