I am calling method onClick function on the img and i want that image id to use further so how to access that image id
con.innerHTML += '<table id=results width=915 border=1 style=margin:-46px 0 0 -2px;><tr><td><input id=chkbox'+j+' type=checkbox name=click_1 value=> '
+ str
+ '</td><td colspan=4 align=right><a href=javascript:presenter.command('viewPdf',{'path': '/images/pdf/animal/Beef/'+j+'.pdf'});><img src=images/view.png style=margin-left:250px;></a> <img src=images/email.png id='+j+' onClick=mytest()></td></tr>'+ break_line +'<img src=images/line.png style=margin-bottom:-47px;></table>';
here is the function i want to store the id of image which is j in this
function mytest(){
var ab=document.getElementById('j');
alert(ali this is wokring fine);
}