Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder seanmarkham's Avatar
    Join Date
    Dec 2011
    Location
    Lincolnshire, England
    Posts
    54
    Thanks
    11
    Thanked 0 Times in 0 Posts

    Changing images on a set date

    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

    PHP Code:
    <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> 

  • #2
    Regular Coder
    Join Date
    Jan 2012
    Posts
    271
    Thanks
    2
    Thanked 65 Times in 65 Posts
    PHP Code:
    <img src="gfx/<?php echo date("Y-m-d") < '2012-02-27' 'valentines.gif' 'experience.gif';?>" name="slide" width="626" height="300" border="0" />

  • Users who have thanked jmj001 for this post:

    seanmarkham (01-27-2012)

  • #3
    New Coder seanmarkham's Avatar
    Join Date
    Dec 2011
    Location
    Lincolnshire, England
    Posts
    54
    Thanks
    11
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by jmj001 View Post
    PHP Code:
    <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

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

    PHP Code:
    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

  • #4
    Regular Coder
    Join Date
    Jan 2012
    Posts
    271
    Thanks
    2
    Thanked 65 Times in 65 Posts
    cool cheers


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •