www.webdeveloper.com
Page 3 of 3 FirstFirst 123
Results 31 to 35 of 35

Thread: How to Loop Images in a webpage with an even delay?

  1. #31
    Join Date
    Nov 2010
    Posts
    6
    Hmm I must be doing something wrong... table coming up with blank background:


    <script type="text/javascript">
    var pictureArchive=

    ['images/rotator/1.jpg','images/rotator/2.jpg','images/rotator/3.jpg','images/rotator/4.jpg'];

    window.onload=function() {
    rotate(pictureArchive.length);
    }

    function rotate(idx) {
    if(idx>=pictureArchive.length) {
    idx=0;
    }
    document.getElementByID('mbusu')[0].style.backgroundImage = 'url

    ('+pictureArchive[idx++]+')';
    timerID=setTimeout(function(){rotate(idx)}, 5000);
    }</script>


    <table id="mbusu" border="0" height="311" width="873"

    cellspacing="0" cellpadding="0" >

    <tr><td>etc etc



    Sorry for being a pain in the butt Fang!

  2. #32
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    Code:
    document.getElementById('mbusu').style.backgroundImage = 'url('+pictureArchive[idx++]+')';
    At least 98% of internet users' DNA is identical to that of chimpanzees

  3. #33
    Join Date
    Nov 2010
    Posts
    6
    Cool! It finally works. Can't thank you enough! Prepare to be assimilated and stuff...! Make it so Number One! and erm... don't wear a red shirt!

  4. #34
    Join Date
    Nov 2012
    Posts
    1

    centering the images

    That code worked great for looping the images, how does one center the images on the page vertically speaking?

    thanks

  5. #35
    Join Date
    Aug 2013
    Posts
    1

    How do i get it to repalce an image in a Cell

    Quote Originally Posted by Fang View Post
    Code:
    document.getElementById('mbusu').style.backgroundImage = 'url('+pictureArchive[idx++]+')';

    I have the following cell with an image in it i want to replace with this loop script. how would I modify the script to work as an image loop in this cell

    <div class="WORKAREA"><!-- semitransparent box -->
    <img src="images/poochpax_box_mockup_no_title.png" alt="" border="0"</img>
    </div><!-- end WORKAREA -->

    The CSS for .WORKAREA is:
    .WORKAREA {
    /* This is the section where the "universal content" of each page is displayed. */
    /* background-color: #FFEAEA; */
    background-color: transparent;
    padding: 20px;

Thread Information

Users Browsing this Thread

There are currently 2 users browsing this thread. (0 members and 2 guests)

Posting Permissions

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



Recent Articles