...

View Full Version : Changing images on a set date



seanmarkham
01-27-2012, 11:52 AM
I am trying to change one image that is part of a scroll, but on a certain date, so if i am unable to manually do it on the day it will still be done, i want the 'gfx/valentines.gif' file to change to 'gfx/experience.gif ' on February 27th 2012.

(please excuse the lack of indenting)

Here is the code i am currently using



<body>
</SCRIPT>
<link href="styles_akr2010.css" rel="stylesheet" type="text/css" />
<script src="script_akr2010.js"></script>
<script type="text/javascript">
<!--
var image1=new Image ()
image1.src="gfx/valentines.gif"
var image2=new Image ()
image2.src="gfx/Kids_Karting.gif"
var image3=new Image ()
image3.src="gfx/Kart_Building.jpg"
var image4=new Image ()
image4.src="gfx/Ancaster_Bar.gif"
var image5=new Image ()
image5.src="gfx/Paintball_Fort.jpg"
var image6=new Image ()
image6.src="gfx/bowling_livewires.gif"
var image7=new Image ()
image7.src="gfx/Ancaster_Quads.jpg"
var image8=new Image ()
image8.src="gfx/Paintball_Mask.jpg"
var image9=new Image ()
image9.src="gfx/New_Karts.jpg"
var image10=new Image ()
image10.src="gfx/Paintball_Group.JPG"
var image11=new Image ()
image11.src="gfx/Muddy_Experience.jpg"
var image12=new Image ()
image12.src="gfx/2011_Membership.jpg"
var image13=new Image ()
image13.src="gfx/Circuit_Air.gif"
var image14=new Image ()
image14.src="gfx/Karts_Grid.gif"
var image15=new Image ()
image15.src="gfx/Karting_Carpark.jpg"
var image16=new Image ()
image16.src="gfx/Bowling_Alley.jpg"
//-->
</script>

<td width="618"><div align="center">
<a href="javascript:slidelink()"><img src="gfx/valentines.gif" name="slide" width="626" height="300" border="0" /></a>
<script>
<!--
//variable that will increment through the images
var step=1
var whichimage=1
function slideit(){
//if browser does not support the image object, exit.
if (!document.images)
return
document.images.slide.src=eval("image"+step+".src")
whichimage=step
if (step<16)
step++
else
step=1
//call function "slideit()" every 4.0 seconds
setTimeout("slideit()",4000)
}
slideit()
function slidelink(){
if (whichimage==1)
window.location="/Gift_Experience.php#valentines"
else if (whichimage==2)
window.location="/Kids_Club/Kids Club.php"
else if (whichimage==3)
window.location="/Karting/index.php"
else if (whichimage==4)
window.location="/About/facilities.php"
else if (whichimage==5)
window.location="/Paintball/index.php"
else if (whichimage==6)
window.location="/Bowling/index.php"
else if (whichimage==7)
window.location="/Quads/index.php"
else if (whichimage==8)
window.location="/Paintball/index.php"
else if (whichimage==9)
window.location="/Karting/index.php"
else if (whichimage==10)
window.location="/Paintball/index.php"
else if (whichimage==11)
window.location="/Quads/index.php"
else if (whichimage==12)
window.location="/Membership/index.php"
else if (whichimage==13)
window.location="/Karting/circuit.php"
else if (whichimage==14)
window.location="/Karting/index.php"
else if (whichimage==15)
window.location="/About/facilities.php"
else if (whichimage==16)
window.location="/Bowling/index.php"
}
//-->
</script>
</body>

jmj001
01-27-2012, 12:06 PM
<img src="gfx/<?php echo date("Y-m-d") < '2012-02-27' ? 'valentines.gif' : 'experience.gif';?>" name="slide" width="626" height="300" border="0" />

seanmarkham
01-27-2012, 01:07 PM
<img src="gfx/<?php echo date("Y-m-d") < '2012-02-27' ? 'valentines.gif' : 'experience.gif';?>" name="slide" width="626" height="300" border="0" />

Thanks that has worked perfectly, i thought it would be alot harder than that, i needed to add it to the following sections too



var image1=new Image ()
image1.src="gfx/<?php echo date("Y-m-d") < '2012-02-27' ? 'valentines.gif' : 'experience.gif';?>"


and



function slidelink(){
if (whichimage==1)
window.location="/<?php echo date("Y-m-d") < '2012-02-27' ? 'Gift_Experience.php#valentines' : 'Gift_Experience.php';?>"


thank you much apprieciated jmj001

jmj001
01-27-2012, 04:03 PM
cool cheers :thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum