I am using this to set the new onclick event:

<script type="text/javascript">
var links = new Array();
links = document.getElementsByTagName("td");

for(var i=0;i<links.length;i++){
var tempfunc = links[i].onclick;
//*****EXTRACT THE URL*****//
var url = "http://www.sitepoint.com"; //say this is the url you extracted
links[i].onclick=function(){window.top.location.href=url};
}
</script>

How do I get the URL from the current onclick event?