SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Dec 2005
    Location
    Chiddingfold, UK
    Posts
    68
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how to have 'good morning' in the a.m. and 'good afternoon' in the p.m. ?

    Hi all,

    Does anyone know of a way to detect the time (a user's local time) when a they're browsing your site and have a 'good morning' in the body of the text become a 'good afternoon' and then 'good evening' as appropriate?

    My client would like to have this but it's a new one on me! Thanks for any advice.

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    16,433
    Mentioned
    160 Post(s)
    Tagged
    1 Thread(s)

    mornin'

    You could use the javascript Date object to get the users time. A conditional test would determine if it's morning or night etc. There should be plenty of scripts at javascript "free scripts" sites for you to "copy and paste" if you don't want to put it together yourself. You should be able to find one the replaces/writes the text where ever you want it to be.

  3. #3
    SitePoint Member
    Join Date
    Dec 2005
    Location
    Austin, TX
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you want to use JavaScript to do this, you can learn it at hrere: http://www.w3schools.com/js/default.asp . They have lots of examples too that might be exactly what you're looking for.
    Last edited by DanielMalone; Apr 13, 2006 at 19:17.
    Daniel Malone
    Read the News, Bible, and other
    info. Plus news and bible search!
    www.DanielJMalone.com

  4. #4
    SitePoint Enthusiast
    Join Date
    Dec 2005
    Location
    Chiddingfold, UK
    Posts
    68
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ha ha! Thanks - unfortunately I'm not a code man and so the time to learn javascript is likely to be extensive - I need this yesterday!


Bookmarks

Posting Permissions

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