I've been trying to incorporate an Adblock detecter that will display one image when Adblock is detected and another when Adblock isn't detected. The only problem is that the image is displayed and formatted by CSS. So is there a way to change the image that CSS displays through js?
html:
<div id="adblockFrame">
<script type="text/javascript" src="js/advertisement.js"></script>
<script type="text/javascript">
if (document.getElementById("TestAdBlock") != undefined)
{
document.getElementById('adblockFrame').innerHTML="<img src='images/ImageHolderno.png' alt='no adblock' />";
}
else
{
document.getElementById('adblockFrame').innerHTML="<img src='ImageHolderyes.png' alt='Adblock detected!' />";
}
Bear in mind that the image place holders and void and do not serve a purpose as the image is defined by CSS.
CSS:
#mainPicture .picture
{
position:relative;
width:650px;
height:325px;
top:10px;
background-image:url(../images/minibg1.png);
background-repeat:no-repeat;
margin-left:10px;
}