SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Jun 2008
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Javascript image rotator wont work inside Iframe using IE! Help!

    Hello! Ok, I am brand new to Javascript and I don't know what I can do to make this work.

    I am using a script that will rotate images in sequential order upon page refresh.

    You can see it here: http://magicbroadcasting.net/testgallery.htm

    Now, I am using Iframe to embed it on this page too:
    http://island106.com/PhotoWall.asp?id=40867

    On the magicbroadcasting.net site, it works great when you reload the page in both firefox and ie.

    When I use the iframe on Island106.com, it works great using FF but it will not work using IE! I don't know what it is!

    Here is the the only clue that I can come up with:

    -If you notice on magicbroadcasting.net using IE, when you reload the page, it goes from Image A to a missing image link for a split second then to image B..

    -Upon the next reload it goes from Image B to missing link for split second then to image C...

    - Now, when you try it in the iframe on island106.com, it goes from Image A to the missing image link for a split second to image A again!

    To sum it up, I want to get the script on magicbroadcasting.net to work in the iframe on Island106.com. It's driving me crazy! I've been working on it for 2 weeks and I have no idea how to fix it! Please help!

    Here is the code I am using:
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <script type="text/javascript">
    <!--
    var quotes= new Array();
    quotes[0]="KidsFest/kf1.jpg";
    quotes[1]="KidsFest/kf2.jpg";
    quotes[2]="KidsFest/kf3.jpg";
    quotes[3]="KidsFest/kf4.jpg";
    quotes[4]="KidsFest/kf5.jpg";
    quotes[5]="KidsFest/kf6.jpg";
    quotes[6]="KidsFest/kf7.jpg";
    quotes[7]="KidsFest/kf8.jpg";
    quotes[8]="KidsFest/kf9.jpg";
    quotes[9]="KidsFest/kf10.jpg";
    quotes[10]="KidsFest/kf11.jpg";
    quotes[11]="KidsFest/kf12.jpg";
    
    
    function setCookie() {
    num=num+1;
    if(num>11) {
    num=0;
    }
    var which = "quotes["+num+"]";
    var now = new Date();
    now.setTime(now.getTime() + 30*24*60*60*1000);
    var expString = "; expires=" + now.toGMTString();
    document.cookie = "Quote_="+which+expString;
    }
    
    function setQuote() {
    if (/Quote_=quotes\[(\d*)\]/.test(document.cookie)) {
    document.getElementById("quotes").src =quotes[RegExp.$1*1];
    num=RegExp.$1*1;
    setCookie();
    }
    else {
    document.getElementById("quotes").src =quotes[0];
    num=0;
    setCookie();
    }
    }
    //-->
    </script>
    </head>
    
    <body>
    <img id="quotes" src="" width="375" height="281" alt="">
    <body onLoad="setQuote('KidsFest/kf1.jpg','KidsFest/kf2.jpg','KidsFest/kf3.jpg','KidsFest/kf4.jpg','KidsFest/kf5.jpg','KidsFest/kf6.jpg','KidsFest/kf7.jpg','KidsFest/kf8.jpg','KidsFest/kf9.jpg','KidsFest/kf10.jpg','KidsFest/kf11.jpg','KidsFest/kf12.jpg')"> 
    </body>
    </html>

  2. #2
    SitePoint Addict
    Join Date
    May 2006
    Posts
    349
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    These will do what you need content cookie rotator

    Just do it in php instead of javascript and name your page with php. Since its on page load only it doesn't need to be in javascript. They might have some that do it on page load only in javascript as well.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •