skendo Posted October 17, 2015 Share Posted October 17, 2015 (edited) Hei everyone. i need a solution to find : When any one clicks on any ad network banner that i place on site after a click on banner i want it to hide / remove. I need this so wont have multiple ad clicks and prevent being banned If some one can help me with the code how to make for example adhitz banner after a click made by that visitor to get hidden. I dont need a function on a simple click anywhere on page. I need when banner clicked to get hidden after the click is made on it. Edited October 17, 2015 by skendo Quote Link to comment Share on other sites More sharing options...
hansford Posted October 17, 2015 Share Posted October 17, 2015 (edited) You have 2 options to accomplish this. Using plain JavaScript or with jQuery (or other library). I'll post the JavaScript way. <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Insert title here</title> </head> <body> <a id="banner" href="http://www.purple.com" target="_blank"><img src="banner.jpg" width="400" height="150"></a> <script type="text/javascript"> window.onload = function() { var el = document.getElementById('banner'); el.addEventListener("click",function() { this.style.display = "none"; }); }; </script> </body> </html> Edited October 17, 2015 by hansford Quote Link to comment Share on other sites More sharing options...
skendo Posted October 17, 2015 Author Share Posted October 17, 2015 But can this work for a banner that is already based on Javascript and not my own create HTML image banner. because need to use this for adhitz banner. Quote Link to comment Share on other sites More sharing options...
hansford Posted October 17, 2015 Share Posted October 17, 2015 (edited) Sure. Put the script which dynamically generates the banner in a div and just hide the div after it's clicked. Edited October 17, 2015 by hansford Quote Link to comment Share on other sites More sharing options...
dergsa12 Posted March 8, 2020 Share Posted March 8, 2020 (edited) This is my adhitz code: <script type="text/javascript" src="https://adhitzads.com/1078536"></script> For which place I need insert it? Edited March 8, 2020 by dergsa12 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.