Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-29-2006, 09:03 PM   PM User | #1
bailyesboy
New to the CF scene

 
Join Date: Jan 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
bailyesboy is an unknown quantity at this point
Exclamation 10 Minute Clock

Has anyone got a script where an image (image 1) is on the screen at 12:00 and then 10 minutes later (12:10) image 2 comes up.

I need a script where the image changes every 10 minutes depending on the time.

Thanks
Simon
bailyesboy is offline   Reply With Quote
Old 01-29-2006, 09:24 PM   PM User | #2
Lerura
Regular Coder

 
Lerura's Avatar
 
Join Date: Aug 2005
Location: Denmark
Posts: 869
Thanks: 0
Thanked 112 Times in 111 Posts
Lerura will become famous soon enough
can image2 be a random picture or must it follow a specified order??
Lerura is offline   Reply With Quote
Old 01-30-2006, 03:54 PM   PM User | #3
bailyesboy
New to the CF scene

 
Join Date: Jan 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
bailyesboy is an unknown quantity at this point
Quote:
Originally Posted by lerura
can image2 be a random picture or must it follow a specified order??
Specified order.
bailyesboy is offline   Reply With Quote
Old 01-30-2006, 06:27 PM   PM User | #4
Lerura
Regular Coder

 
Lerura's Avatar
 
Join Date: Aug 2005
Location: Denmark
Posts: 869
Thanks: 0
Thanked 112 Times in 111 Posts
Lerura will become famous soon enough
i guess this is what you want:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title></title>
<meta  http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<link rel="stylesheet" type="text/css" href="stylesheet.css" />
<style type="text/css"><!--

--></style>
<script type="text/javascript" src="javascript.js"></script>
<script type="text/javascript"><!--

SwapImageID='Something'; //  ID of image to swap
SwapImage=new Array();
SwapImage[0]='xx00.gif'; //  shown from xx:00 to xx:10
SwapImage[1]='xx10.gif'; //     -||-    xx:10 to xx:20
SwapImage[2]='xx20.gif'; //     -||-    xx:20 to xx:30
SwapImage[3]='xx30.gif'; //     -||-    xx:30 to xx:40
SwapImage[4]='xx40.gif'; //     -||-    xx:40 to xx:50
SwapImage[5]='xx50.gif'; //     -||-    xx:50 to xx:00

function Swap(){
x=new Date();
M=x.getMinutes();
Q=(M-(M%10))/10;
document.getElementById(SwapImageID).src=SwapImage[Q];
NextSwap=600000-x%600000;
setTimeout('Swap()',NextSwap);
}
// --></script>
</head>
<body onload="Swap()">
<img id="Something" />
</body>
</html>
Lerura is offline   Reply With Quote
Old 01-30-2006, 06:49 PM   PM User | #5
bailyesboy
New to the CF scene

 
Join Date: Jan 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
bailyesboy is an unknown quantity at this point
Quote:
Originally Posted by lerura
i guess this is what you want:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title></title>
<meta  http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<link rel="stylesheet" type="text/css" href="stylesheet.css" />
<style type="text/css"><!--

--></style>
<script type="text/javascript" src="javascript.js"></script>
<script type="text/javascript"><!--

SwapImageID='Something'; //  ID of image to swap
SwapImage=new Array();
SwapImage[0]='xx00.gif'; //  shown from xx:00 to xx:10
SwapImage[1]='xx10.gif'; //     -||-    xx:10 to xx:20
SwapImage[2]='xx20.gif'; //     -||-    xx:20 to xx:30
SwapImage[3]='xx30.gif'; //     -||-    xx:30 to xx:40
SwapImage[4]='xx40.gif'; //     -||-    xx:40 to xx:50
SwapImage[5]='xx50.gif'; //     -||-    xx:50 to xx:00

function Swap(){
x=new Date();
M=x.getMinutes();
Q=(M-(M%10))/10;
document.getElementById(SwapImageID).src=SwapImage[Q];
NextSwap=600000-x%600000;
setTimeout('Swap()',NextSwap);
}
// --></script>
</head>
<body onload="Swap()">
<img id="Something" />
</body>
</html>
Good script but i need it to last 1 week (10,080 mins) and I need a link on the pics.

Thanks
Simon
bailyesboy is offline   Reply With Quote
Old 01-30-2006, 08:11 PM   PM User | #6
Lerura
Regular Coder

 
Lerura's Avatar
 
Join Date: Aug 2005
Location: Denmark
Posts: 869
Thanks: 0
Thanked 112 Times in 111 Posts
Lerura will become famous soon enough
... and if each picture should only be shown once per week, it will become 1008 different pics in a week.

if so the script will be HUGE since every combination of picture and link must be stored in an array. (i guess it will be 80k or more)

if i should be able to help you further i need to know more about the looping sequence
Lerura is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:19 PM.


Advertisement
Log in to turn off these ads.