1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Script That Rotates iFramed Pages

Discussion in 'HTML & JavaScript' started by Geshwinn, Oct 17, 2011.

  1. Geshwinn

    Geshwinn Power Member

    Joined:
    Aug 12, 2009
    Messages:
    607
    Likes Received:
    112
    Location:
    East of Eden
    Home Page:
    Hi guys,

    Can you help me out with a simple script that rotates iframes every time the website reloads?
     
  2. BlueZero

    BlueZero Power Member

    Joined:
    Jul 6, 2011
    Messages:
    500
    Likes Received:
    257
    Occupation:
    Webdeveloper, Project Manager
    Location:
    Byte in the Net
    Home Page:
    It it should change only when the whole page reloads, then you can do it in PHP.
    Make an array of links to rotate and display random.
    But you can surely do the same in JS, but it seems more legit in PHP.
    If you want the code, i can write it in both PHP and JS. Just choose.
     
  3. Geshwinn

    Geshwinn Power Member

    Joined:
    Aug 12, 2009
    Messages:
    607
    Likes Received:
    112
    Location:
    East of Eden
    Home Page:
    I would very much appreciate this.

    What do you mean by 'seems more legit'?
     
  4. BlueZero

    BlueZero Power Member

    Joined:
    Jul 6, 2011
    Messages:
    500
    Likes Received:
    257
    Occupation:
    Webdeveloper, Project Manager
    Location:
    Byte in the Net
    Home Page:
    If you would code it in PHP, then noone could determine what you are doing just by viewing source code.

    Code:
    $aLinks = array(
    'htt*://domain1*com/link',
    'htt*://domain2*com/link',
    'htt*://domain3*com/link',
    'htt*://domain4*com/link',
    'htt*://domain5*com/link',
    'htt*://domain6*com/link',
    );
    echo '<iframe src="'.$aLinks[rand(0, count($aLinks)-1)].'" height="200" width="200"></iframe>';
    
    i cant post URLs but you surely understand where they are ;-)