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 to the CF scene
    Join Date
    Mar 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    script that outputs different things based on when feed was updated

    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
    Code:
    <div class="andrewupdated andrewtoday"></div>
    But currently nothing is being output. The script ive pieced together is below.

    Code:
    /*@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.
    Last edited by firago; 08-26-2006 at 10:39 PM.

  • #2
    New to the CF scene
    Join Date
    Mar 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    can anybody help me out with this?


  •  

    Posting Permissions

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