start image swap javascript from fixed server time -
i'm setting simple mobile site charity , want show own ad banners local supporting businesses on bottom. i've got simple javascript swaps image banner every 10 seconds next in sequence:
window.onload = function () { var rotator = document.getelementbyid("adbox"); var images = rotator.getelementsbytagname("img"); (var = 1; < images.length; i++) { images[i].style.display = "none"; } var counter = 1; setinterval(function () { (var = 0; < images.length; i++) { images[i].style.display = "none"; } images[counter].style.display = "block"; counter++; if (counter == images.length) { counter = 0; } }, 7000); //1000 = 1 second }; <body ontouchstart=""> <div id="adbox"> <img src="_/ads/1.jpg" alt="one" width="320" height="70"> <img src="_/ads/2.jpg" alt="two" width="320" height="70"> <img src="_/ads/3.jpg" alt="three" width="320" height="70"> <div> </body>
however resets , goes start of sequence when load different page. want start sequence @ fixed server time (say midnight) , cycle through, when load new page, don't go start of banners go 'ad server time'.
i think simplest , fairest way ads. did @ using iframe mean main site have sit in 1 , believe support of iframes on touch devices not great (which major issue this).
hmmm.
sounds don't need images 'rotate'.
how this:
case(servertime) if( 00.00 -> 04.00 )[ show ad #1 ] if( 04.01 -> 08.00 )[ show ad #2 ] if( 08.01 -> 12.00 )[ show ad #3 ] if( 12.01 -> 14.00 )[ show ad #4 ]
obviously above isn't valid code idea ?
Comments
Post a Comment