This is an example of the HTML a publisher can use to place any collection of ads on his or her site so that all will be hidden except one random ad for each page refresh. You can see an example of the output here: http://jsfiddle.net/TUats/embedded/result/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="cj_rolling_container"> | |
<!-- Put Your Ads In This Container Like So --> | |
<a href='http://www.kqzyfj.com/click-6743399-11396752' target='_top'> | |
<img src='http://www.lduhtrp.net/image-6743399-11396752' width='300' height='250' alt='' border='0' /> | |
</a> | |
<a href='http://www.kqzyfj.com/click-6743399-11396757' target='_top'> | |
<img src='http://www.lduhtrp.net/image-6743399-11396757' width='300' height='250' alt='' border='0' /> | |
</a> | |
<a href='http://www.kqzyfj.com/click-6743399-11396760' target='_top'> | |
<img src='http://www.lduhtrp.net/image-6743399-11396760' width='300' height='250' alt='' border='0' /> | |
</a> | |
<a href='http://www.kqzyfj.com/click-6743399-11396761' target='_top'> | |
<img src='http://www.lduhtrp.net/image-6743399-11396761' width='300' height='250' alt='' border='0' /> | |
</a> | |
</div> | |
<script> | |
var elements = document.querySelectorAll("#cj_rolling_container > *"); | |
var choice = Math.floor(Math.random()*elements.length); | |
for(var i=0; i<elements.length; i++){ | |
if (i!==choice) elements[i].style.display='none'; | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment