|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
#1 |
|
It can never be too quiet
Join Date: May 2004
Location: Burlington, Ontario
Posts: 1,090
|
JavaScript to "getDate" compatible with Firefox
SORRY EVERYONE, MY MISTAKE.
I'VE FIXED THE ISSUE (I DIDN'T HAVE AN ID IN THE FIELDS THEMSELVES... )Hi Folks, I have a script that is calculating the date and time and then I am writing that date and time to a couple of hidden fields on the click of the a submit button to be sent to a cgiemail delivery. Here's the script: HTML Code:
function setdatetime()
{
var thedate=new Date();
var nday=thedate.getDay();
var nmonth=thedate.getMonth();
var ntoday=thedate.getDate();
var nyear=thedate.getYear();
if (nday==0) nday="Sunday";
if (nday==1) nday="Monday";
if (nday==2) nday="Tuesday";
if (nday==3) nday="Wednesday";
if (nday==4) nday="Thursday";
if (nday==5) nday="Friday";
if (nday==6) nday="Saturday";
if (nmonth==0) nmonth="January";
if (nmonth==1) nmonth="February";
if (nmonth==2) nmonth="March";
if (nmonth==3) nmonth="April";
if (nmonth==4) nmonth="May";
if (nmonth==5) nmonth="June";
if (nmonth==6) nmonth="July";
if (nmonth==7) nmonth="August";
if (nmonth==8) nmonth="September";
if (nmonth==9) nmonth="October";
if (nmonth==10) nmonth="November";
if (nmonth==11) nmonth="December";
if (nyear<=99) nyear= "19"+nyear;
if ((nyear>99) && (nyear<2000)) nyear+=1900;
var thetime=new Date();
var ampm="AM";
var nhour=thetime.getHours();
var nminute=thetime.getMinutes();
if (nhour > 11) ampm = "PM";
if (nhour > 12) nhour = nhour - 12;
if (nhour == 0) nhour = 12;
document.getElementById('datestamp').value = (""+nday+", "+nmonth+" "+ntoday+", "+nyear);
document.getElementById('timestamp').value = (""+nhour+":"+nminute+" "+ampm);
}
Any help is greatly appreciated. Thanks very much, Stryker
__________________
Athlon XP 2800+ • Asus A7N8X (nVidia Nforce2) • Radeon 9600 Pro 256MB • 2x512MB KVR DDR PC3200 Dual Channel • 120GB Seagate 7200RPM 8MB • 160GB WD 7200RPM 8MB • Liteon DVD±RW DL • AOpen DVD±RW DL • Vantec Ion2 350W PSUSend me your picture for the Member Photo Gallery Last edited by Stryker; 12-30-2004 at 06:16 AM. Reason: FIXED ISSUE ALREADY ! ! ! ! |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|