PDA

View Full Version : Is this possible? Can someone help?


Golden_Eagle
07-01-2002, 04:25 PM
This javascript I have found is pretty good, but not quite what I need.......

http://www.geocities.com/Heartland/Plains/8022/ddate.html

I need to find a javascript that will write out the full date using the same images ie...

Monday 1st July, 2002

Is it possible to adapt this while using twelve images for months, 7 for days, and making a st, nd, rd and th for the date? The numbers are pretty simple (x10). The images aren't a problem. The Javascript is.

I would prefer if possible to keep the <BODY> Tag clear of "onload" or anything for that matter.
(Just a linked .js file is ideal!)

Can anyone help me or am I looking to deep into this?

justame
07-01-2002, 04:31 PM
gol...
just a checkout® this link...
http://www.javascriptkit.com/script/cutindex1.shtml
n' ifin' its what youre looking for??? thennn you can just a externalize® the javascript...lol...

whammy
07-02-2002, 12:14 AM
Here's a javascript I adapted from an ASP script I wrote, that does just that:


/* Today's Date in real English © 2002 Rob K. Davis */
var monthname = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
var weekdayname = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
var mydate = new Date();
var myday = mydate.getDay();
var mymonth = mydate.getMonth();
var mydayno = mydate.getDate();
var dateext = "th"
if(mydayno == 1 || mydayno == 21 || mydayno == 31){
dateext = "st";
}
else if(mydayno == 2 || mydayno == 22){
dateext = "nd";
}
else if(mydayno == 3 || mydayno == 23){
dateext = "rd";
}
var myyear = ((mydate.getYear() < 100) ? "19" : "") + mydate.getYear();
var clientdate = weekdayname[myday] + ", "+ monthname[mymonth] + " "+ mydayno + dateext + ", "+ myyear;


:)

P.S. To write the "English Date" to the page, you'd include that as a separate .js file, and just write the date to the page like:

<script language="javascript" type="text/javascript">
<!--
document.write(clientdate);
// -->
</script>

whammy
07-03-2002, 12:19 AM
P.S. How to implement the images, you said is the easy part - so I'll leave that to you - but you're right, it shouldn't be too hard.

i.e. I'd just have an image for every possible letter, number, comma, etc. that the date script could return (perhaps stored in a 2D array or something to make it somewhat simple, (or even 2 associated arrays)), and loop through the string, then write the appropriate image to the page for that character.

:)