Welcome Guest [Log In] [Register]
Search Members Calendar | Rules ZB Code Index IF Code Index
ZBCode
  • Navigation
  • ZBCode
  • Coding Resources
  • Code Requests
  • Completed Requests
  • [Completed] [ZB] Time Logo
Hey, welcome to ZBCode, the premier coding forum for ZB. Here you fill find some of the best Invisionfree and Zetaboards Codes on the network! Unfortunately, you're sorta hovering around in guest mode at the moment; why not join in on the fun? Register an account and you can start accessing the wealth of resources we have available here. Enjoy your stay at ZBCode, and remember to tell all your friends about us; the more members, the more codes available. ;)

Interested in joining? Click here.


If you are already a member of ZBCode, feel free to login right here:

Username:   Password:
Locked Topic
[Completed] [ZB] Time Logo
Tweet Topic Started: Oct 24 2009, 06:24 AM (357 Views)
Joel Oct 24 2009, 06:24 AM Post #1


Posts:
75
Group:
Member
Member
#733
Joined:
Aug 25, 2008
Coding language
HTML/CSS
Hi,

I want to be able to have 2 Banners on my board, one for the daytime and one for the night time. So from 18:00 to 06:59 it displays the night time banner, and then from 07:00 to 17:59 it displays the daytime banner. I already have a script for this, but for some reason, it doesnt seem to work. Could anyone fix the problem with this script or create a script to do the same thing? :)

The script I tried to use is below:

Spoiler: click to toggle
<script>
/* TimeBanner by Eureka of Divinity Coding and The Coding Zone */
var _br = [];
_br[_br.length] = ["18:00","Night_URL"];
_br[_br.length] = ["07:00","Day_URL"];

document.write("<script src='http://divinitycoding.net/scripts/TimeBanner.js'><\/script>");
</script>

Cheers :D
Offline Profile Goto Top
 
Kitsueki Oct 24 2009, 07:12 AM Post #2
Member Avatar
♠ Aizu

Posts:
742
Group:
Dedicated
Member
#3,453
Joined:
Aug 31, 2009
Edit: nvm, I was wrong, ignore this.
Edited by Kitsueki, Oct 24 2009, 07:13 AM.
Kingdom of Etruria
Spoiler: click to toggle
Kingdom of Etruria


Starring in the Medieval times, this Kingdom is an isolated territory not bothered by any other Kingdoms.
The military has recently caught on to something big, and its their job to stop it.
Will you walk your own path, or aid the Etrurian Military in exterminating the evil that is about to come forth?
It's Ready!

Kingdom of Etruria is a Roleplaying forum I created, also with the help of a few friends.
You can pick from many classes, fight any way you want, and gain rank in the military, or even start your own Faction.
It all starts with a Character Registration, if you're interested in taking part of this RP, PM me and I'll be sure to give you the link when I open it.
There are many things to do at Kingdom of Etruria, so be sure to find out for yourself
Thanks for reading!

Offline Profile Goto Top
 
Gorgor Oct 24 2009, 07:30 AM Post #3
Hello

Posts:
1,187
Group:
Former Staff
Member
#2,728
Joined:
Apr 2, 2009
Coding language
PHP
Is it displaying the wrong logo at the time, or is it just not changing the logo?
Edited by Gorgor, Oct 24 2009, 07:33 AM.
Offline Profile Goto Top
 
Joel Oct 24 2009, 08:22 AM Post #4


Posts:
75
Group:
Member
Member
#733
Joined:
Aug 25, 2008
Coding language
HTML/CSS
Its not displaying anything at all.
Offline Profile Goto Top
 
Gorgor Oct 24 2009, 08:27 AM Post #5
Hello

Posts:
1,187
Group:
Former Staff
Member
#2,728
Joined:
Apr 2, 2009
Coding language
PHP
Hmm... when I put the URL for the hosted script in the address bar it redirects me somewhere else, but when I click it on a link I go to it.

Try using this:
Code:
 

/* TimeBanner by Eureka of Divinity Coding and The Coding Zone */
var _br = [];
_br[_br.length] = ["18:00","Night_URL"];
_br[_br.length] = ["7:00","Day_URL"];

/*
* TimeBanner.js
* By Eureka of Divinity Coding [http://divinitycoding.net]
* Partnership with The Coding Zone [http://thecodingzone.com]
* Copyright must remain in-tact.
*/

var _eureka = new Date(), _Eh = _eureka.getHours(), _Em = _eureka.getMinutes(), _eb = -1, _eImg = "";
while (_br[++_eb] !== undefined) {
var _bS = _br[_eb][0].split(":"), _bH = parseInt(_bS[0]), _bM = parseInt(_bS[1]);
if (_br[_eb][0].match(/^\d{1,2}:\d{1,2}$/) && !isNaN(_bH) && _bH >= 0 && _bH < 24 && !isNaN(_bM) && _bM >= 0 && _bM < 60){
if ((_bH == _Eh && _bM >= _Em) || _bH < _Eh) _eImg = _br[_eb][1];
}
}
document.getElementById("logo").getElementsByTagName("img")[0].src=_eImg;
Offline Profile Goto Top
 
Joel Oct 24 2009, 08:32 AM Post #6


Posts:
75
Group:
Member
Member
#733
Joined:
Aug 25, 2008
Coding language
HTML/CSS
Still displays no banner :(
Offline Profile Goto Top
 
Gorgor Oct 24 2009, 08:38 AM Post #7
Hello

Posts:
1,187
Group:
Former Staff
Member
#2,728
Joined:
Apr 2, 2009
Coding language
PHP
Try using this. I re-did it with a simple code :)
Code:
 
day = "DAY_URL"
night = "NIGHT_URL"

hour = new Date().getHours();
if(hour > 6){ $("#logo img").attr("src","<img src='"+day+"'>") } else { $("#logo img").attr("src","<img src='"+night+"'>") }
Offline Profile Goto Top
 
Joel Oct 24 2009, 11:08 AM Post #8


Posts:
75
Group:
Member
Member
#733
Joined:
Aug 25, 2008
Coding language
HTML/CSS
Thanks Gorgor. Request complete. :)
Offline Profile Goto Top
 
Choco Oct 24 2009, 11:19 AM Post #9
Member Avatar
¡ʎɹoʇɔɐɟ ʎʇıʌɐɹƃ ɐ uı pǝddɐɹʇ ɯ,ı 'dןǝɥ

Posts:
589
Group:
Admins
Member
#3,272
Joined:
Jun 30, 2009
Coding language
Everything
You're welcome.
See? We can read thoughts too. ;)

Your request has been completed, and we're moving it to the correct forum. We hope it works for you; if it doesn't, feel free to post another request topic in the requests forum. Just remember: read the rules first!

Thanks,
The ZBCode Staff
Posted ImageIt's a magical world, Hobbes, ol'd buddy... ...let's go exploring!
In progress: Something Special ;)
Offline Profile Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Completed Requests · Next Topic »
Locked Topic

Track Topic · E-mail Topic Time: 2:27 PM Jul 11
Hosted for free by ZetaBoards · Privacy Policy