★ wanayoo — archive 1999 http://javascript.about.com/compute/javascript/library/weekly/aa042399.htmNouvelle recherche | Portail wanayoo
Enter Sweepstakes! · Advertise on this site · Get Bargains
About.com  
You are here:  About > Computing/Technology > Focus on JavaScript
an About site
   About.com
 
 One of Over 700 Sites
Your Guide with Guide
Nate Kassebaum
Bio | Contact

Subjects
Compatibility
Reference
Animation Scripts
Cookie Scripts
Image Scripts
Text Scripts
Frame Scripts
Form Scripts
HTML Scripts
Navigation Scripts
Password Scripts
Time Scripts
Window Scripts
Software
Beginner Tutorials
Cookie Tutorials
Image Tutorials
Text Tutorials
Form Tutorials
Frame Tutorials
Multimedia
Navigation Tutors
Time Tutorials
Handling Variables
Window Tutorials

Subject Library 

All articles on this topic

Bookstore
Find books related to this topic Click Here

Videostore
Find videos related to this topic Click Here

ShoppingAbout
Your favorite products, right here Click Here

Stay up-to-date!
Subscribe to our newsletter.

Do you like our sites?
Wish to share them with others - and earn money?
Become an Affiliate

More Sites On This Topic
Apply to become
a partner
for this site.

Search for 
in   Sites A to Z
 
 

Today in JavaScript

Dateline: 04/23/99

Everybody wants their web pages to look new.  This is especially true for sites that claim to be "on top of things;" sites that are in fact about news.   Nobody takes the time to go buy yesterday's newspaper, so why shouldn't your site always be about "today?"

Today, this web site is about:

If your web page displays the current day (today is ), it feels a little more up-to-date.  It's easy to display the current day using JavaScript.

JavaScript has a built-in method called getDay(), that returns a number between 0 and 6 signifying what day of the week it is.  Take the following code, for example:

theDate = new Date ();
today = theDate.getDay();

today will contain a 0 on Sunday, a 1 on Monday, a 2 on Tuesday, and so on.  It is simple from this point to make an array of day names and display them, load an appropriate graphic, display a different link each day, whatever you can come up with.  Here's an array of day names:

whatDay = new Array();
whatDay[0] = "Sunday";
whatDay[1] = "Monday";
whatDay[2] = "Tuesday";
whatDay[3] = "Wednesday";
whatDay[4] = "Thursday";
whatDay[5] = "Friday";
whatDay[6] = "Saturday";

Which can be translated into text:

document.write("Today is " + whatDay[today] + " and the weather is nice.");

Or an image:

document.write('<img src=/old?u=http%3A%2F%2Fjavascript.about.com%2Fcompute%2Fjavascript%2Flibrary%2Fweekly%2F%26quot&y=1999' + whatDay[today] + '.gif">');

Related Links:
Image of the Day from The Complete Webmaster
Day of the Week Image Displayer from Website Abstraction
Scripts - Time
Tutorials - Time

Previous Features



Email this page!

Sponsored Links
Netsetter - the free download accelerator
Download and install the Netsetter software and you can double your internet speed and have a chance to win a BMWZ3 Sports Car!
http://www.commission-junction.com/  (Listing fee: $0.33)
Find Practically Anything on Earth at eBay!
eBay - the world's largest online trading site where people buy, sell or trade practically anything on earth. Over 4 million items available in over 4,000 categories including javascript
http://cgi.ebay.com/  (Listing fee: $0.30)
Increase your download speeds for FREE!
Netsetter will optimize your web browser and internet connection settings to increase your internet speed by up to 100%.
http://www.commission-junction.com/  (Listing fee: $0.23)
Web Design for Search Engines - Web Position Gold
Web design & promotion software for higher search engine ranking. WebPosition Gold optimizes, submits, & tracks your site for top results. FREE Trial download.
http://www.web-gold.net/  (Listing fee: $0.22)
Computer Training Videos & CD ROMs
Planetlearn.com provides over 2000 self paced computer training programs available on video, cd rom, and online.
http://www.planetlearn.com/  (Listing fee: $0.21)
Sponsor this site More...


 
 Advertising
AllBusiness.com
Create your business plan. Here’s how.

win millions!!
Just three easy steps can make you a millionaire!

HotJobs.com
Better Jobs for a Better Life

Win a piece of *NSYNC!
Head to Alloy.com for a chance to score your very own platinum copy of No Strings Attached!

single pixel
single pixel
Marketplace
register domains
get a website$499
long distance deal
- - free stuff - -
meet your match
virtual makeover
high paying jobs
quick jobs search
free ebiz solutions
meet your match
build a business
$50 off mp3 player
meet your match
book club
longdistancedeal

 
Related sites
single pixel
on About 
Focus on Java
Focus on Web3D
HTML
Perl
Personal Web Pages
Web Design
XML


Explore More On The About Network
Search
Arts/Humanities ·  Autos ·  Cities/Towns ·  Comedy ·  Computing/Technology ·  Cultures ·  Education ·  Food/Drink ·  Gadgets ·  Games ·  Health/Fitness ·  Hobbies ·  Home/Garden ·  Homework Help ·  Industry ·  Internet/Online ·  Jobs/Careers ·  Kids ·  Money ·  Movies ·  Music/Performing Arts  ·  News/Issues ·  Parenting/Family ·  People/Relationships ·  Pets ·  Recreation/Outdoors ·  Real Estate ·  Religion/Spirtuality ·  Science ·  Shopping ·  Small Business ·  Sports ·  Style ·  Teens ·  Travel ·  TV/Radio · 
 
single pixel

For more information, visit
Our Story, Be a Guide, or Advertise. For rules of use,
read our User Agreement and
Privacy & Kids Privacy Policy.

Having a problem?
Report it here.

About Canada   ·    About UK

 
Copyright  © 2000 About.com, Inc.
About and About.com are registered trademarks of About.com, Inc.
The About logo is a trademark of About.com, Inc.
All rights reserved.