title: how to get the id name in html for any object
body: <p>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 </p>
  
  <pre><code>  con.innerHTML += '&lt;table id="results" width="915" border="1" style="margin:-46px 0 0 -2px;"&gt;&lt;tr&gt;&lt;td&gt;&lt;input id="chkbox'+j+'" type="checkbox" name="click_1" value=""&gt;&amp;nbsp;'
          + str
          + '&lt;/td&gt;&lt;td colspan="4" align="right"&gt;&lt;a href="javascript:presenter.command(\'viewPdf\',{\'path\': \'/images/pdf/animal/Beef/'+j+'.pdf\'});"&gt;&lt;img src="images/view.png" style="margin-left:250px;"&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;img src="images/email.png" id="'+j+'" onClick=mytest()&gt;&lt;/td&gt;&lt;/tr&gt;'+ break_line +'&lt;img src="images/line.png" style="margin-bottom:-47px;"&gt;&lt;/table&gt;';
  </code></pre>
  
  <p>here is the function i want to store the id of image which is j in this </p>
  
  <pre><code>     function mytest(){
  
       var ab=document.getElementById('j');
  
       alert("ali this is wokring fine");
  
      }
  </code></pre>