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 2 of 2
  1. #1
    New Coder
    Join Date
    Dec 2006
    Posts
    12
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Rotating a banner with time clock

    I hope I am sincerely placing this in the right area.

    I have a main banner (flash) on my site/message board and I would like to have 2 banners that rotate according to the time of day.

    I would like to have the banner change at 7 P.M and 7 A.M. ( I have a night banner and a day banner.

    I know this has to do with the If / else Code. I have no idea how to do this code.I have researched and cannot figure it out. If anyone can help it would be very appreciated!

    The following is what I have right now for my code for a single banner.

    Code:
    <div class="borderwrap">
    <div id="logostrip"><a href='{ipb.script_url}'>
    <!--ipb.logo.start-->
    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="900" height="240" align="absbottom">
    <param name="quality" value="high">
    <param name="SRC" value="/mybanners/mtt.swf">
    <param name="SCALE" value="noborder">
    <embed src="/mybanners/mtt.swf" width="900" height="240" align="absbottom" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" scale="noborder"></embed></object>
    <!--ipb.logo.end-->
    </a>
    </div>
    Thank you

    Danno

  • #2
    Regular Coder
    Join Date
    Jan 2007
    Posts
    213
    Thanks
    0
    Thanked 0 Times in 0 Posts
    For this you would use a javascript time function, check if the time was less than 07 or greater than 19 and use innerHTML to change a DIV to show the correct banner

    Code:
    Stamp = new Date();
    Hours = Stemp.getHours();
    
    if (Hours <= 7){
    	//show night time banner
    	document.getElementById("logostrip").innerHTML = "<a href='{ipb.script_url}'><!--ipb.logo.start--><object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width=\"900\" height=\"240\" align=\"absbottom\"><param name=\"quality\" value=\"high\"><param name=\"SRC\" value=\"/mybanners/mtt.swf\"><param name=\"SCALE\" value=\"noborder\"><embed src=\"/mybanners/mtt.swf\" width=\"900\" height=\"240\" align=\"absbottom\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" scale=\"noborder\"></embed></object><!--ipb.logo.end--></a>";
    } else if (hours >= 19){
    	//show nighttime banner
    	document.getElementById("logostrip").innerHTML = "<a href='{ipb.script_url}'><!--ipb.logo.start--><object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width=\"900\" height=\"240\" align=\"absbottom\"><param name=\"quality\" value=\"high\"><param name=\"SRC\" value=\"/mybanners/mtt.swf\"><param name=\"SCALE\" value=\"noborder\"><embed src=\"/mybanners/mtt.swf\" width=\"900\" height=\"240\" align=\"absbottom\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" scale=\"noborder\"></embed></object><!--ipb.logo.end--></a>";
    } else {
    	//show daytime
    	document.getElementById("logostrip").innerHTML = "<a href='{ipb.script_url}'><!--ipb.logo.start-->THIS IS THE SECOND ONE<!--ipb.logo.end--></a>";
    }
    of coure you would put that into a function to load on page load hope that helps
    Matthew Bagley
    Paramiliar Design Studios
    Website Design | Website Development | Search Engine Optimisation (SEO)


  •  

    Posting Permissions

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