SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    What's HTML?
    Join Date
    May 2001
    San Diego, CA
    0 Post(s)
    0 Thread(s)

    Read/print file from another server...

    I'm running into a problem right now that is driving me nuts. Let me explain what I'm trying to do...

    I bought a big advertisement from Company A. Company A pastes my ad code on one of their pages. All HTML. No problems.

    Now here's the kicker, there are 5 specific days this month that I want to use a "special" ad. On March 6th I want to use Ad #1, on March 7th I want to use Ad #2, on March 8th Ad #3, March 9th Ad #4, March 10th Ad #5, and any other date should display Ad #6.

    Ad #X =

    So basically I want a JavaScript file on my server that when called determines the date and prints out the proper ad on the calling page. Company A can then call this JavaScript from their HTML page and then my ad prints on their server.

    How do I go about doing this?
    Ryan Kuhle - A Proud Advisor - Got Questions? Just Ask!
    Get your website started for less than $20! Click Here

  2. #2
    SitePoint Wizard silver trophy
    Join Date
    May 2003
    0 Post(s)
    0 Thread(s)
    Not entirely clear on the methodology here (SSI?) but, how 'bout:

    //-----------------------------------------------------------------> include ad
    var baseURL = '';
    var today = new Date();
    var whatday = today.getDate();
    var isMarch = (today.getMonth() == 2);
    if (isMarch)
    	filenum = (whatday < 6 || whatday > 10) ? 6 : whatday - 5;
    	document.write(baseURL + filenum + '.txt');
    else document.write(default URL);
    ::: certified wild guess :::


Posting Permissions

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