Getting id of Clicked Element

You can use 'event.target.id' or 'this.id' to obtain the id of the clicked element.


RESETRUNFULL
<img id="product1" src="product1.png"
             onclick="toProductPage(event)"/><script>
   function toProductPage(event){
      location="product.php?id="+event.target.id;
   }</script>

<img id="product1" src="product1.png"
          onclick="location='product.php?id='+this.id"/>