title: How can i return img.src by clicking on an image with javascript?
body: <p>I am trying to create a function with javascript where a user upon clicking on an image can retrieve that images src as a URL. I am very new to javascript and my attempts so far at creating a function activated by "onclick" of an image are:</p>
  
  <pre><code>var showsrc = function(imageurl)
  var img = new Image();
  img.src = imageurl
  return img.src
  </code></pre>
  
  <p>to call the results  i have been trying to insert the image.src into my  html using</p>
  
  <pre><code>document.getElementById("x").innerHTML=imageurl; 
  </code></pre>
  
  <p></p>
  
  <p>Im having very little success. Any help would be greatly appreciated.  Thank you.</p>