If your using jquery the easiest way is to use the [attribute$=value] method - an example to get the aspx made link id, from your coded id:
//include jquery.js then:
$(document).ready(function(){$("a[id$='login_link']").click(function(event){tester(event,this)});});
function tester(event, el){
event.preventDefault();
alert($(el).attr("id"));
}
//for element: