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 8952195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:49:24+00:00 2026-06-15T13:49:24+00:00

My goal is to have an image preload while it is loading the actualy

  • 0

My goal is to have an image preload while it is loading the actualy image, but I can’t quite figure it out. The whole goal for this is that I have a slideshow that displays an image, but sometimes it is slow to load.. lol. Here’s my HTML:

<div id="slideshow">
    <img src="../images/slideshow/spacer.gif" width="100" height="100" id="myPicture" alt="some image">
</div>

Here’s my javascript I have already:

window.onload = choosePic;

function choosePic() {
    var myPix = new Array("../images/slideshow/sempiternal.png", "../images/slideshow/cross.png", "../images/slideshow/pentagram.png");
    var randomNum = Math.floor((Math.random() * myPix.length));
    document.getElementById("myPicture").src = myPix[randomNum];
}

And the CSS:

#slideshow {
    height: 100px;
    width: 100px;
    position: fixed;
    bottom: 20px;
    right: 20px;
}
  • 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-06-15T13:49:25+00:00Added an answer on June 15, 2026 at 1:49 pm

    Doesn’t seem like your function will preload anything. Apart from the random image selected which loads normally, the other images in the array will not be called at all.

    You might want to check out JavaScript Preloading Images and Function to preload images? instead.

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

Sidebar

Related Questions

My goal is to have a background image swapped out according to the day
My goal is to take an image (size varies) and have it fit within
My goal is to have the url routing as following: http://www.abc.com/this-is-peter-page http://www.abc.com/this-is-john-page What is
So my goal is to have an image slideshow with 3 clickable hot spots
My goal is to have a list of items each item has an image
My big picture goal is to have a grey field over an image, and
I have a borderless NSButton that contains an image and is subclassed with my
I have a table that looks like this in a usercontrol. Then the usercontrol
My goal is to include a FullCalendar into JQueryMobile. I have followed this guide
At the moment, I have a goal of writing an application that contains a

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.