0

I had used these two lines in my script. But everytime, ist line is working. How can i make second line active. so that my code work properly.

document.getElementById("sideimage").onclick = null; 
document.getElementById("sideimage1").onclick = null; 
<div id="sidebar1" style="border-radius: 7px; background: #fff; border: 1px solid #666; -moz-box-shadow: 0 0 5px 3px #888; -webkit-box-shadow: 0 0 5px 5px #888; box-shadow: 0 0 2px 2px #888; text-align: center; margin-bottom: 20px;">  
  <img id="sideimage" style="border-radius: 5px; width: 100%; cursor: pointer;" onclick="return showForm('liki_intro_popup')" src="{{media url="wysiwyg/Free_Shipping_1.png"}}" alt="free shipping" />
</div>
<div style="border-radius: 7px; background: #fff; border: 1px solid #666; -moz-box-shadow: 0 0 5px 3px #888; -webkit-box-shadow: 0 0 5px 5px #888; box-shadow: 0 0 2px 2px #888; text-align: center; margin-bottom: 5px;">
  <a><img id="sideimage1" style="border-radius: 5px; width: 100%; cursor: pointer;" title="LeaseItKeepIt" onclick="return showForm('liki_intro_popup')" src="{{media url="wysiwyg/liki_banner_homepage.png"}}" alt="LeaseItKeepIt" width="215" height="230" /></a>
</div>
codeConcussion
  • 12,739
  • 8
  • 49
  • 62

1 Answers1

0

The js might not fire, because of the anchor tag <a> not having an href.

You should either remove it, or add href="#" like this (see link):

<a href="#"><img id="sideimage" style="border-radius: 5px; width: 100%; cursor: pointer;" title="LeaseItKeepIt" onclick="return showForm('liki_intro_popup')" src="{{media url="wysiwyg/liki_banner_homepage.png"}}" alt="LeaseItKeepIt" width="215" height="230" /></a>

Maybe you can also try moving the onclick inside the <a> tag, if the upper doesn't work.

Community
  • 1
  • 1
ilans
  • 2,537
  • 1
  • 28
  • 29