JAVA Goodies

* SCRIPT TYPES
Calendars, Clocks, Calculators
Scrolling Text
Buttons, Links, Email, Forms
Color Scripts
Text Display
Image Scripts
Alert Boxes, Prompts
Cookies, Passwords, Counters
Games
Misc Scripts
* JavaScript Directory
* JavaScript Library
* JavaScript Discussions
HTML Goodies
* Free Images
Search Central
* Job Bank
* Classifieds
* Journal
* News Central
* Calendar
* Software
For Sale
* Books
For Sale
----- Journal:

Get the weekly
email highlights
from the most popular
online Journal
for developers!
Current issue
-----
developer.com
developerdirect.com
htmlgoodies.com
javagoodies.com
jars.com
intranetjournal.com
javascripts.com
datamation.com
-

JAVA Goodies

Tip from: John

     It seems that some Java Script clocks are off a month. Here may be the reason yours is. Thanks to John for offering us this quick fix:


     Hey, I was looking on your site to see if you might have anything I could use as a reference when I came across a script for displaying the date in numbers. There is a small problem with the script. The month will always be off by one with this method. In JavaScript the month values are 0-11 not 1-12, so you have to increment the month by 1.

     Here's how I overcame this in a script I wrote. You can use the document write method to put the date on the page, or what I used it for, as a value for a textbox in a form.

<script language="JavaScript">
<!-- hide script
todaysDate = new Date();
today = todaysDate.getDate();
month = todaysDate.getMonth();
year = todaysDate.getYear();
theDate = ++month + "/" + today + "/" + year;
//end hiding -->
</script>

....Thanks John.

Handsome guy, huh?

Master List of Goodies

Goodies Tutorials



HomeAbout UsSearchSubscribeContact UsFAQs
Use of this site is subject to certain Terms & Conditions.
Copyright (c) 1996-1998 EarthWeb Inc. All rights reserved. Reproduction in whole or in part in any form or medium without express written permission of EarthWeb is prohibited.