title: Comparison between 2 src in javascript
body: <p>I want to compare 2 image src in this code. It's not working, maybe because the paths of these src are not absolute. So how to have the absolute paths of these images?</p>
  
  <p>HTML</p>
  
  <pre><code>  &lt;td&gt;&lt;img  id='1' src="photo1.gif" onclick="func(this)" &gt;&lt;/td&gt;
    &lt;td &gt;&lt;img id='2' src="photo2.gif" onclick="func(this)"&gt;&lt;/td&gt;
    &lt;td &gt;&lt;img id='3'  src="photo3.gif" onclick="func(this)"&gt;&lt;/td&gt;
  </code></pre>
  
  <p>JS</p>
  
  <pre><code>&lt;script&gt;
   function compare()
  if(document.getElementById('1').src==document.getElementById('2').src)
  alert("photo1=photo2")
  &lt;/script&gt;
  </code></pre>