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>
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.