ok,from what i understand, you need a javascript function binded on the onclick event of the generated links that sends you back to a different page the link content.
if that's what you need, i recommend using a library such as jquery (it's more easy ti use) and paste this code into the page:
$('a').click(function(){
$.post("url_of_the_page_you_want_to_send",
{data : $(this).html()});
});
hope this helps :|