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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T08:17:06+00:00 2026-05-24T08:17:06+00:00

I need to change the image along with associated caption randomly every 24 hours

  • 0

I need to change the image along with associated caption randomly every 24 hours on a coldfusion homepage. I have about 50 images and captions and I don’t want to do this manually every day. Could you point me to any examples of javascript source code? Thanks.

I also want to be able to enlarge the pic using a lightbox. Can someone tell me how to modify the code to do that?

  • 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-24T08:17:06+00:00Added an answer on May 24, 2026 at 8:17 am

    You really shouldn’t do those things on the server-side. If you don’t plan on adding images you could just send the current datetime (if you don’t trust the client computer time) and leave the rest to javascript.

    oImages = [
      {time: '2011-01-01', img: 'path/to/image.ext', caption: "image caption"},
      ... more images ...
    ];
    

    On page load, you just create the image tag and pass the source based on the server time:

    window.onload = function(){
      for(i in oImages){
       if(oImages[i].time == "coldfusion_time") oTodayImage = oImages[i];
      }
      oImg = document.creatElement("img");
      oImg.setAttribute("title", oTodayImage.caption);
      oImg.setAttribute("src", oTodayImage.img);
      document.body.appenChild(oImg);
    };
    

    You just need to output the server time instead of the “coldfusion_time” in the if statement, and either hardcode the javascript array objects or output what you need with coldfusion.

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

Sidebar

Related Questions

I have some images that need to change, based not only on hover, but
I need change the background image, so I using: $('body').css({backgroundImage : 'url(images/wallpaper/'+wp+'.jpg)'}); But, I
I have this method that changes an larger image source on click. I need
I need to make javascript code to swap images with option change. Here is
I need change background of all text that have two spaces from the start
My question is if I have a Lion image just I want to change
i need to select change some data and change image in own form each
I've a situation where I need to change the src of an image using
So I need to change the size of an image depending on the area
Need to change image back ground when click on HREF with other function <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.