Results 1 to 3 of 3
  1. #1
    Join Date
    May 2009
    Posts
    413
    Plugin Contributions
    0

    Default Any JavaScript gurus out there??

    I have added a simple javascript banner rotator created with a free online generator into one of my banners via admin>tools>banner manager

    I have simply pasted the following generated code into the 'HTML Text:' box on the banner manager page.

    <script type="text/javascript">
    var imgs1 = new Array("/images/banners/free_box_banner.jpg","/images/banners/free_shipping_banner.jpg");
    var lnks1 = new Array("http://www.mydomain.com/index.php?main_page=page&id=25","http://www.mydomain.com/index.php?main_page=shippinginfo");
    var alt1 = new Array(" Free Gift Box!","Free Shipping Worldwide");
    var currentAd1 = 0;
    var imgCt1 = 2;
    function cycle1() {
    if (currentAd1 == imgCt1) {
    currentAd1 = 0;
    }
    var banner1 = document.getElementById('adBanner1');
    var link1 = document.getElementById('adLink1');
    banner1.src=imgs1[currentAd1]
    banner1.alt=alt1[currentAd1]
    document.getElementById('adLink1').href=lnks1[currentAd1]
    currentAd1++;
    }
    window.setInterval("cycle1()",4000);
    </script>
    <a href="http://www.mydomain.com/index.php?main_page=page&id=25"" id="adLink1" target="_top">
    <img src="/images/banners/free_box_banner.jpg" id="adBanner1" border="0" width="537" height="80"></a>



    The script works as planned, BUT for some reason it hangs on initial page load. So instead of showing the first image for 4 seconds then rotating to the next it waits 8 seconds. After the first rotation it works normally.

    Can anyone tell me how to fix this?

    Thanks :)

  2. #2
    Join Date
    Sep 2010
    Posts
    3
    Plugin Contributions
    0

    Default Re: Any JavaScript gurus out there??

    Thank you for the Idea it works wonderfully. Sorry I can't be of more assistance. Could possibly be the loading of the images why the first change takes so long?

  3. #3
    Join Date
    Jul 2010
    Posts
    15
    Plugin Contributions
    0

    Default Re: Any JavaScript gurus out there??

    This is brilliant, just what I've been looking for! Mine also hangs at page load, but so does all of my javascript things, like scrolling boxes and image slideshow. So I'm guessing it can't handle everything at once

 

 

Similar Threads

  1. Any Amazon integration out there?
    By magneteye in forum General Questions
    Replies: 7
    Last Post: 21 Jul 2008, 07:06 PM
  2. Popup image size. Any javascript brains out there?
    By marknew in forum General Questions
    Replies: 1
    Last Post: 7 Nov 2007, 03:33 PM
  3. to all you gurus out there
    By amassere in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 2 Jun 2006, 04:54 PM

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
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR