Treehouse: Grow your CSS skills. Land your dream job.

Looking for a script.

  • # March 5, 2012 at 9:53 am

    I need to rotate through an affiliate ad and another ad when the page is refreshed. I don’t really want to use a plugin. Can someone point me in the right direction.

    # March 5, 2012 at 6:21 pm

    One way I’ve done before was make them have a 50/50 chance of showing

    if (rand() % 2 == 0 ){
    //show one ad
    } else {
    //show another

    This generates a random number, and checks if its odd or even
    Not perfect, but worked for me

    # March 5, 2012 at 6:54 pm


Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.