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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:56:46+00:00 2026-05-28T16:56:46+00:00

I have a PHP script that displays an image(according to the current time) and

  • 0

I have a PHP script that displays an image(according to the current time) and I want it to flash the image so I tried adding a script to do so but its some what not working. Please have a look. I would be thankful for your help. Thanks in advance.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

</head>

<body onload="startit();">
<?php
$hour = date('H', time()); // Returns the hours of the server time, from 0 to 23.

switch ($hour) {
case '0':
$img = '0.jpg';
break;
case '1':
$img = '0.jpg';
break;
// ... and so on...
default:
$img = '1.jpg';
}

?>

<img src="<?php echo $img; ?>" id="mydiv" />
<script language=javascript>
/*This script written by Chris Stahl*/
/*It may be used and modified by */
/*webmaster's for private use.      */
function startit() {
window.setInterval("changecolor()",100);
}

function changecolor() {
var rndred=Math.floor(256*Math.random());
var rndgreen=Math.floor(256*Math.random());
var rndblue=Math.floor(256*Math.random());
var colorarray=[rndred, rndgreen, rndblue];
var hexcolor="#";
for(i=0;i<3;i++) {
 hexcolor=hexcolor +""+ converttohex(Math.floor(colorarray[i]/16));
 hexcolor=hexcolor +""+ converttohex(colorarray[i]%16);
}
document.getElementById("mydiv").style.color=hexcolor;
}
function converttohex(num) {
switch (num) {
case 10: return "A";
case 11: return "B";
case 12: return "C";
case 13: return "D";
case 14: return "E";
case 15: return "F";
default: return num;
}
}
</script>


</body>
</html>
  • 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-28T16:56:47+00:00Added an answer on May 28, 2026 at 4:56 pm

    This will work

    http://jsfiddle.net/mplungjan/9Kdh5/

    <body>
      <div id="myDiv"><img src="http://rd.cas.de/tim/native/image.png" id="myImg" /></div>
    </body>
    
    <script type="text/javascript>
    /* This script written by Chris Stahl */
    /* It may be used and modified by     */
    /* webmaster's for private use.       */
    
    window.onload=function() {
      window.setInterval(changecolor,100);
    }
    
    function changecolor() {
      var rndred=Math.floor(256*Math.random());
      var rndgreen=Math.floor(256*Math.random());
      var rndblue=Math.floor(256*Math.random());
      var colorarray=[rndred, rndgreen, rndblue];
      var hexcolor="#";
      for(i=0;i<3;i++) {
        hexcolor=hexcolor +""+ converttohex(Math.floor(colorarray[i]/16));
        hexcolor=hexcolor +""+ converttohex(colorarray[i]%16);
      }
      document.getElementById("myDiv").style.backgroundColor=hexcolor;
    }
    function converttohex(num) {
      switch (num) {
        case 10: return "A";
        case 11: return "B";
        case 12: return "C";
        case 13: return "D";
        case 14: return "E";
        case 15: return "F";
        default: return num;
      }
    }
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a script image.php that is quite long, but I've just copied
I have php script that creates a temporary watermark image for users that are
I have a PHP script that initialises an image gallery. It loops through all
I have a PHP script that can encode a PNG image to a Base64
We have a small php script, that displays random adverts on our site .
I currently have a script ready that resizes a whole image with GD but
I am working on a PHP script that automatically displays an image based on
know nothing about php, but I have this script that reads a folder and
I have an image uploader that runs on a separate PHP script, and then
I have a nice php and ajax script that uploads a photo and displays

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.