New Zenner
- Join Date:
- Nov 2010
- Posts:
- 52
- Plugin Contributions:
- 0
Sill trying to get logo script working...ARG!!
Ok I had posted this issue before and had limited success getting it to work. When I did what someone what suggested the screen want blank and a "view source" rendered a blank text document. I then accidentally deleted a directory in ZC that rendered the program useless. I know...I'm a bonehead!!
This time around I have properly setup for my overrides and backed up the entire ZC system (just to be on the safe side.
I am now using a custom template I am doing myself called "abyss".
OK I will explain what I am trying to do. I have a stripped down mockup HERE. Once you get the the page take notice of the header/logo combo..it should be a wintry scene.
ACTUALLY TRY THIS!!
Now; Change the date on your computer to December 25 and refresh the webpage. The header/logo combo should have automatically changed to a Christmas theme!! All in all that's what the script does is checks the date, finds the image that corresponds with that date, then uses the appropriate image. NOTE: *If you do a "view source" you will see this line:
[B]<img src="./logo.jpg" onload="setImgByDate(this,holiday)">[/B]
The image "logo.jpg" is a failsafe/default logo.*
Now you can head over to my ZC and see where I am with this problem. You can get there HERE
As you can see the script is not working at all (except for the default logo). I have used the instructions for adding javascript as well as using the onload command to no avail.
The actual JavaScript is below..it's actually pretty simple. As you can see I have used full paths to the images just to be safe.
<script language="javascript" type="text/javascript">
<!--
var holiday = [
[ "1025", "1030", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logohalow.jpg" ],
[ "1101", "1111", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logoremem.jpg" ],
[ "1112", "1130", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logoautumn.jpg" ],
[ "1201", "1209", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logowinter.jpg" ],
[ "1210", "1223", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logogreetings.jpg" ],
[ "1224", "1226", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logoxmas.jpg" ],
[ "1227", "1230", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logowinter.jpg" ],
[ "1231", "1231", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logonewyear.jpg" ],
[ "0101", "0103", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logonewyear.jpg" ],
[ "0104", "0206", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logowinter.jpg" ],
[ "0207", "0214", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logovalen.jpg" ],
[ "0215", "0309", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logowinter.jpg" ],
[ "0310", "0317", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logostpatty.jpg" ],
[ "0318", "0319", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logowinter.jpg" ],
[ "0320", "0331", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logospring.jpg" ],
[ "0401", "0401", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logofool.jpg" ],
[ "0402", "0421", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logospring.jpg" ],
[ "0422", "0423", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logogood.jpg" ],
[ "0424", "0425", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logoeaster.jpg" ],
[ "0426", "0523", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logospring.jpg" ],
[ "0524", "0525", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logovictor.jpg" ],
[ "0526", "0620", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logospring.jpg" ],
[ "0621", "0630", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logosummer.jpg" ],
[ "0701", "0702", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logocanada.jpg" ],
[ "0703", "0921", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logosummer.jpg" ],
[ "0922", "1001", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logoautumn.jpg" ],
[ "1002", "1010", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logothanks.jpg" ],
[ "1011", "1024", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logoautumn.jpg" ],
];
function disable(){return false}
function setImgByDate(imgRef,dateList) {
imgRef.onload = disable;
var today = new Date();
var month = 1+today.getMonth();
if (month<10) month = "0"+month;
var date = today.getDate();
if (date<10) date = "0"+date;
var MMDD = ""+month+date;
for (var i=0; i<dateList.length; i++) {
if (MMDD>=dateList[i][0] && MMDD<=dateList[i][1]) {
imgRef.src = dateList[i][2];
return;
}
}
}
//--></script>
Last but not least; the trigger for the JavaScript is:
<img src="./logo.jpg" onload="setImgByDate(this,holiday)">
Any help would be awesome!! I don't know JavaScript nor do I know PHP....so spell it out for me. I am fluent in XHTML, HTML and CSS.
Thanks again...in a advance:D:laugh::thumbsup: