...

View Full Version : script that outputs different things based on when feed was updated



firago
08-25-2006, 08:12 PM
I am trying to make a script that outputs a block of code depending how recently a certain feed was updated. for example, if it was updated today, the output would hopefully be
<div class="andrewupdated andrewtoday"></div>But currently nothing is being output. The script ive pieced together is below.


/*@cc_on @*/
/*@if (@_jscript_version >= 5)
try {
xmlhttp = new ActiveXObject("http://canssite.com/andrew/rss/?section=article");
} catch (e) {
try {
xmlhttp = new ActiveXObject("http://canssite.com/andrew/rss/?section=article");
} catch (E) {
xmlhttp = false;
}
}
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='http://canssite.com/andrew/rss/?section=article') {
try {
xmlhttp = new XMLHttpRequest(http://canssite.com/andrew/rss/?section=article);
} catch (e) {
xmlhttp=false;
}
}
if (!xmlhttp && window.createRequest) {
try {
xmlhttp = window.createRequest();
} catch (e) {
xmlhttp=false;
}
}

function DocAge1() {
var daysago = (new Date() - new Date(MakeGMT(document.lastModified))) / 86400000;
daysago %= 36525;
if (daysago == 0) document.write("<div class="andrewupdated andrewtoday"></div>");
else if (daysago == 1) document.write("<div class="andrewupdated andrewyesterday"></div>");
else if (daysago == 2) document.write("<div class="andrewupdated andrewtwodaysago"></div>");
else if (daysago == 3) document.write("<div class="andrewupdated andrewthreedaysago"></div>");
else document.write("<div class="andrewupdated"></div>");
}

I am new to writing scripts and have no idea what i have done wrong. Thank you for any help you can give.

firago
08-26-2006, 10:40 PM
can anybody help me out with this?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum