/    Sign up×
Community /Pin to ProfileBookmark

Javascript 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: [url]http://magicbroadcasting.net/testgallery.htm[/url]

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

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>
    [/CODE]

    to post a comment
    JavaScript

    5 Comments(s)

    Copy linkTweet thisAlerts:
    @cgishackJun 06.2008 — I will take a wild guess...

    try taking the code out of the onload event and just call the function at the end of the page.

    Maybe an IFrame's onload does not get fired..

  • * this is just a guess...
  • Copy linkTweet thisAlerts:
    @Syancey1authorJun 07.2008 — Can you please tell me how that would be written?
    Copy linkTweet thisAlerts:
    @cgishackJun 07.2008 — Remove the code from the bodies onload.

    <i>
    </i>&lt;body
    &lt;body onLoad="[B]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')[/B]"&gt; <br/>


    at the bottom of the page (above </html> ) add
    <i>
    </i>&lt;script type="text/javascript"&gt;

    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')

    &lt;/script&gt;



    But again.. its just a guess
    Copy linkTweet thisAlerts:
    @Syancey1authorJun 07.2008 — :sad: unfortunantly not...any other ideas???
    Copy linkTweet thisAlerts:
    @vortexerJun 20.2008 — I don't think it will rotate on next page load exactly correctly from an Iframe on another site. Did you ever get it to yet?
    ×

    Success!

    Help @Syancey1 spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.17,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...