|
Post by tmcewan259 on Nov 7, 2004 14:28:32 GMT
I used to use code for a countdown calendar on my page. When I upgraded to the latest version of the software it stopped showing. Does anyone have any ideas as to the cause. When I re-paste the code it shows a blank box. I would be happy to post the code if anyone wants to try on their own. Any help would be appreciated.
|
|
|
Post by Stormdance on Nov 7, 2004 16:05:48 GMT
Hi Tmcewan259,
Yes, please post your code - with a bit of luck it may just need a minor tweak to make it compatible with the new release.
Cheers, Stormdance
|
|
|
Post by tmcewan259 on Nov 7, 2004 21:49:46 GMT
//////////CONFIGURE THE COUNTDOWN SCRIPT HERE//////////////////
//STEP 1: Configure the countdown-to date, in the format year, month, day, hour(0=midnight,23=11pm), minutes, seconds: setcountdown(2004,06,08,17,30,00);
//STEP 2: Change the two text below to reflect the occasion, and message to display on that occasion, respectively var occasion = "1st day of conditioning for the 2004 season begins in...<br>"; var message_on_occasion = "Happy Conditioning!";
//STEP 3: Configure the below 5 variables to set the width, height, background color, and text style of the countdown area var countdownwidth ='420px'; var countdownheight ='35px'; var countdownbgcolor ='lightyellow'; var opentags ='<font class=reg2a><B>'; var closetags ='</font>';
//////////DO NOT EDIT PAST THIS LINE//////////////////
var montharray = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"); var crosscount = '';
function start_countdown() { if (document.layers) document.countdownnsmain.visibility="show"; else if (document.all||document.getElementById) crosscount=document.getElementById&&!document.all?document.getElementById("countdownie") : countdownie;
countdown(); }
if (document.all||document.getElementById) document.write('<span id="countdownie" style="width:'+countdownwidth+'; background-color:'+countdownbgcolor+'"></span>')
window.onload=start_countdown
function countdown() { var today = new Date(); var todayy = today.getYear(); if (todayy < 1000) todayy += 1900;
var todaym = today.getMonth(); var todayd = today.getDate(); var todayh = today.getHours(); var todaymin = today.getMinutes(); var todaysec = today.getSeconds(); var todaystring = montharray[todaym]+" "+todayd+", "+todayy+" "+todayh+":"+todaymin+":"+todaysec;
futurestring = montharray[mo-1]+" "+da+", "+yr+" "+hr+":"+min+":"+sec;
dd = Date.parse(futurestring) - Date.parse(todaystring); dday = Math.floor(dd/(60*60*1000*24)*1); dhour = Math.floor((dd%(60*60*1000*24))/(60*60*1000)*1); dmin = Math.floor(((dd%(60*60*1000*24))%(60*60*1000))/(60*1000)*1); dsec = Math.floor((((dd%(60*60*1000*24))%(60*60*1000))%(60*1000))/1000*1);
//if on day of occasion if(dday<=0&&dhour<=0&&dmin<=0&&dsec<=1&&todayd==da) { if (document.layers) { document.countdownnsmain.document.countdownnssub.document.write(opentags+message_on_occasion+closetags); document.countdownnsmain.document.countdownnssub.document.close(); } else if (document.all||document.getElementById) crosscount.innerHTML=opentags+message_on_occasion+closetags;
return; } //if passed day of occasion else if (dday<=-1) { if (document.layers) { document.countdownnsmain.document.countdownnssub.document.write(opentags+"Conditioning has already started! "+closetags); document.countdownnsmain.document.countdownnssub.document.close(); } else if (document.all||document.getElementById) crosscount.innerHTML=opentags+"Occasion already passed! "+closetags;
return; } //else, if not yet else { if (document.layers) { document.countdownnsmain.document.countdownnssub.document.write(opentags+occasion+"<br>"+dday+ " days, "+dhour+" hours, "+dmin+" minutes, and "+dsec+" seconds"+closetags); document.countdownnsmain.document.countdownnssub.document.close(); } else if (document.all||document.getElementById) crosscount.innerHTML=opentags+occasion+"<br>"+dday+ " days, "+dhour+" hours, "+dmin+" minutes, and "+dsec+" seconds"+closetags; } setTimeout("countdown()",1000); } </script>
|
|
|
Post by Stormdance on Nov 8, 2004 13:01:44 GMT
Think I've got it... these 3 lines :
dhour = Math.floor((dd%%(60*60*1000*24))/(60*60*1000)*1); dmin = Math.floor(((dd%%(60*60*1000*24))%%(60*60*1000))/(60*1000)*1); dsec = Math.floor((((dd%%(60*60*1000*24))%%(60*60*1000))%%(60*1000))/1000*1);
Notice I've doubled up the % signs. Antenna usually interprets %width% etc. as a property or variable so the percent signs are confusing it. If you use %% instead Antenna will replace them with a single % when the page is built, and the script will be included on the page correctly.
However there seems to be some other errors in the javascript itself, at least Internet Explorer protests at something - but that's a different story...
Cheers, Stormdance
|
|
|
Post by tmcewan259 on Nov 8, 2004 15:36:26 GMT
Okay - I'm struggling. I made the changes and now the box only shows the code - not the actual results of the script. In other words - I get the actual HTML code displayed in the box. Which function should I be using the Extra menu - which one Visual or Custom - I tried both an neither worked. If the code is bad can you suggest another countdown code?
Thanks in advance,
Tom
|
|
|
Post by Stormdance on Nov 10, 2004 17:42:49 GMT
Hi Tom,
I haven't had chance to look at it in detail - but I have tried placing your Javascript on an ordinary web page outside of Antenna and I can't make it work there either.
Internet Explorer just doesn't like it - I think there must be something wrong with the script.
|
|