+ Post New Thread
Results 1 to 3 of 3
Scripts Thread, Javascript - Timed Script in Coding and Web Development; Heres what im looking to do: On a certain date reference one css.file but after that date forget about it. ...
  1. #1

    Join Date
    Apr 2006
    Thank Post
    Thanked 70 Times in 54 Posts
    Rep Power

    Javascript - Timed Script

    Heres what im looking to do:

    On a certain date reference one css.file but after that date forget about it.

    On December 1st display december.css but on 1st January display regular.css

    Any ideas? Could be PHP aswell?

  2. #2

    Join Date
    Jul 2007
    Thank Post
    Thanked 9 Times in 8 Posts
    Rep Power
    in PHP you can just use the date() function to look up that...

    I think Javascript has a similar function and would work in a similar.

    I haven't done anything with PHP or Javascript so I'm useless to you beyond that

    I think you can echo '<link....>'; for PHP and a document.write() in JS... oce you've checked the date...

    PHP Code:

    $date "011208" ){
    '<link ref="blah blah blah">';
    } else {
    '<link ref="usual blah blah blah">';

    Last edited by Lithium; 26th November 2008 at 03:05 PM. Reason: suddenly learnt php

  3. Thanks to Lithium from:

    danIT (26th November 2008)

  4. #3
    mrcrazy04's Avatar
    Join Date
    Nov 2006
    Bedfordshire/Cheltenham, UK
    Thank Post
    Thanked 11 Times in 11 Posts
    Rep Power
    In ASP you could use
    if date < #01/01/2009# then
    response.write "<link href='december.css' rel='stylesheet' type='text/css' />"
    response.write  "<link href='normal.css' rel='stylesheet' type='text/css' />"
    end if
    And you can just place that where you would normally have your CSS reference.

    In PHP it would be
    PHP Code:
    if (date(m)=="12")
    "<link href='december.css' rel='stylesheet' type='text/css' />";
    } else {
    "<link href='normal.css' rel='stylesheet' type='text/css' />";
    Edit: Beat me to it Lithium!
    And yes, a document.write should work in the javascript, which shouldn't be too far off the PHP
    Last edited by mrcrazy04; 26th November 2008 at 03:16 PM. Reason: Fixed PHP

  5. Thanks to mrcrazy04 from:

    danIT (26th November 2008)

+ Post New Thread

Similar Threads

  1. html/ javascript help
    By strawberry in forum Coding
    Replies: 2
    Last Post: 2nd July 2008, 12:22 PM
  2. Timed Internet Access for Specific Computer Suite
    By mburland in forum Wireless Networks
    Replies: 5
    Last Post: 21st April 2008, 03:38 PM
  3. Javascript - Change text
    By danIT in forum Scripts
    Replies: 6
    Last Post: 11th February 2008, 04:12 PM
  4. Timed shutdown problem
    By Lazyletters in forum Windows
    Replies: 7
    Last Post: 4th December 2007, 03:44 PM
  5. JavaScript. Yea or Nae?
    By Irazmus in forum General Chat
    Replies: 5
    Last Post: 30th June 2006, 10:35 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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