Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7496387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T18:35:47+00:00 2026-05-29T18:35:47+00:00

<div id=dragon style=position: absolute; left: 600px; top: 400px; onload=timeimgs(‘9’);> </div> <script language=JavaScript> var anim_images=new

  • 0
 <div id="dragon" style="position: absolute; left: 600px; top: 400px; " onload="timeimgs('9');">

</div>

  <script language="JavaScript">


  var anim_images=new Array();
  //putting drag0 to drag9 png into the anim_images array

   for (i=0;i<=10;i++) {
    var name;
   name=eval("drag" + numb + ".png");
    anim_images.push("name");
     }

      function imgturn(numb) { 

   if (numb == "9") { // This will loop the image

    //getting the image of the array when reach 9
    document["demo"].src=anim_images[9];

    //starting again with drag0.png?
    timeimgs('0');
     }

    else { 

    document["demo"].src=anim_images[numb];


    timeimgs(numb = ++numb);
    }
 }   


  function timeimgs(numb) { // Reusable timer

 thetimer = setTimeout("imgturn('" +numb+ "')", 1000);
  }



  </script>

Right now, it isn’t working yet. it set the drag0.png to 200 width and 200 height. and I want to animate drag0.png to drag9.png continuously.

Any inputs are appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T18:35:50+00:00Added an answer on May 29, 2026 at 6:35 pm

    HTML:

    <div id="dragon" style="position:absolute; left:60px; top:40px; width:640px; height:480px; "></div>
    

    JAVASCRIPT:

    function animateImagesStart() {
        // next array generation code only for my sample/test: comment it or delete
        var imgs=[
                "http://4.bp.blogspot.com/-PilKprMNhpo/TVc4rKk_gKI/AAAAAAAAAWo/O3wPK3kIH_8/s640/two_flowers.preview.jpg",
                "http://1.bp.blogspot.com/-4-NEunVEZxA/TWendjaBwOI/AAAAAAAAAAU/KKO4MDt5xJ0/s640/10_4_orig.jpg",
                "http://4.bp.blogspot.com/-pc9ImOpPTs0/TaxDIYd5JnI/AAAAAAAAA_M/PF8b7H3nCs8/s640/ocean-flowers.jpg",
                "http://4.bp.blogspot.com/-3CjVKRE6kXE/Ti_Gy6fXKuI/AAAAAAAAG3k/-er17XD7uJc/s640/cherry-blossom-pink-flowers-3.jpg",
                "http://whatscookingamerica.net/EdibleFlowers/LavenderFlowers.jpg",
                "http://www.photographyblogger.net/wp-content/uploads/2010/05/flower23.jpg",
                "http://1.bp.blogspot.com/_24bCsL1xWcM/S6ob05W5KbI/AAAAAAAAAOQ/ZEQK9aiR-nQ/s1600/Flowers.jpg",
                "http://3.bp.blogspot.com/_NjdBzKI5nYs/Sc79kMCKxZI/AAAAAAAABu8/vfk6RrGzpPw/s640/flower+sky+wallpaper+image+photo+pic.jpg",
                "http://4.bp.blogspot.com/-ik3E8PBBf70/TwaZ9PMNbrI/AAAAAAAAAG0/kNrGnEbZ-WY/s1600/flowers2.jpg",
                "http://www.funeral-flowers-online.com/funeral-flowers.jpg"
            ];
        // next array generation code based on your code: uncomment it
    /*    
        var imgs=[];
        for(var i=0;i<10;i++)imgs.push("drag"+i+".png"); // 10 images
    */
        // preloading images
        var img,count=imgs.length,
            imageLoadComplete=function(ev) {
                if(ev.type=="error")imgs.splice(imgs.indexOf(this),1);
            };
        for(var i=0;i<count;i++){
            img=new Image();
            img.onerror=imageLoadComplete;
            img.src=imgs[i];
            imgs[i]=img;
        }
    
        var domImg=document.getElementById("dragon"),
            currentImageIndex=0,
            animateImages=function(){
                if(currentImageIndex>=imgs.length)currentImageIndex=0;
                if(imgs[currentImageIndex].complete)domImg.style.backgroundImage="URL("+imgs[currentImageIndex].src+")";
                currentImageIndex++;
                setTimeout(animateImages,1000);
            };
        setTimeout(animateImages,0);
    }
    
    if(window.addEventListener)window.addEventListener("load",animateImagesStart,false);
    else if(window.attachEvent)window.attachEvent("onload",animateImagesStart);
    

    Insure that each of your images has same size (width and height) as DIV#dragon or replace DIV#dragon with IMG#dragon html element and use IMG src property instead of style.backgroundImage. Example: http://jsfiddle.net/RK7u9/1/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

div#thing { position: absolute; top: 0px; z-index: 2; margin: 0 auto; } <div id=thing>
Div 'canvasesdiv' element contains three HTML5 canvases. <div style=position: relative; width: 400px; height: 300px;
Header div on top of the 3 columns Height of all columns must fill
My div element have a relative width, it isn't absolute so I can't use
My div is closing itself. <html><head><title></title> <script type=text/javascript charset=utf-8 src=jquery-1.7.min.js></script> <script> $(document).ready(function(){ $(#wrapper).append( '<div
div ><hr><p><span STYLE=font-size:24; color: black>Site:</span> Downtown Denver DataCenter - CCODEN44 | <span STYLE=font-size:24; color:
The div is 50% opaque and is displayed on top of the site's content,
div.horizontalRule { clear:both; width:100%; background-color:#d1d1d1; height:1px; margin-top:5px; margin-bottom:5px; } This is what I am
The div currently on the right is at the correct position, where i want
$('div.box').html(hello) puts the word hello inside all my div's of class 'box'. They all

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.