HOME | SCRIPT ARCHIVE | TUTORIALS | SUBMIT A SCRIPT | BOOK STORE |
|
A collection of free JavaScript source code you can copy and paste into your web pages. These JavaScripts are here for the taking. All are either written or modified by me, or made available here from other free JavaScript sites. If you need a script modified to suit your specific needs, just send me email. I will try to help.
Sign up for periodic updates by email. I'll be sure to let you know when there is something new worth taking a look at.
Use the search engine (all JavaScript by the way) to find what you're looking for.
|
|
|
OK, I have to admit, I did not write this piece of code. But it sure will be useful in making all your date based JavaScripts work on January 1, 2000. (provided of course that we all have electricity)
The JavaScript getYear() date method returns a two digit date up to 1999, and a four digit date from 2000 onward. To ensure that we actually get a four digit date, use a y2k() function, which when give a two or four digit year, will always return a four digit year:
function y2k(number) { return (number < 1000) ? number + 1900 : number;}
Then you can call this in any of your scripts which rely on the getYear() method, like this:
var year = y2k(today.getYear());
I noticed some problems with the Event Display script developed for White Pines Roller Rink after the new year, so here is a bug fix for you.
You may recall, the roller rink has special events every weekend and wanted to display the upcoming promotions on their site but did not want to be changing html code every few days. This new code replaces the old at Dynamic Event Display.
If you have a JavaScript you'd like posted on this site, please email it to scriptboy@geocities.com.
Problems? Questions? Need one of my scripts customized? Let me know and I'll try to help.