JavaScript - Ie And .getmonth()
Hi all,
I've got this working perfectly in FF, I have some code that gets the month of a date object, and it doesn't work in IE and it doesn't make sense why... Code: var date = cdr.c[id].date; var month = date.getMonth(); But .getMonth() returns NaN... It is a valid date object as it works perfectly in FF. If you need more code just ask! Similar Tutorialsi am making a hire script for my website, we have a summer and a winter rate for hires over 28 days, so if the month is between march and September its one price ( sting 9) and if its not then its sting 8. please can someone help Code: function calculate() { var days = parseInt('0' + document.date.days.value, 10), groupstring, total = 0; <!-- 1 day, 2 days, 3 days, 4 days, 5 days, 6 days, 7 days, 28 DaySummer, 28 DayWinter, Excess Amount, excess miles................................. --> switch (document.date.car.value) { case 'A': groupstring = '2500,5000,7500,10000,12500,12800,13000,45000,42000,25000,10'; break;<!--PANDA/SAMRT --> case 'B': groupstring = '2650,5300,7950,10600,13250,13500,14500,48000,46000,25000,10'; break;<!--CLIO 3/5/MAN PIC --> case 'CD': groupstring = '2800,5600,8400,11200,14000,14500,15500,49900,48000,25000,10'; break;<!-- RIO CLIO T PIC AUTO--> case 'E': groupstring = '3000,6000,9000,12000,15000,15500,16500,53500,51000,25000,10'; break;<!-- VENGA RIO AUTO--> case 'F': groupstring = '3200,6400,9600,12800,16000,17000,17500,58000,54000,25000,15'; break;<!-- FOCUS/MEGANE/CEED--> case 'G': groupstring = '3500,7000,10500,14000,17500,19000,20000,62000,59000,25000,15'; break;<!--ESTATE --> case 'H': groupstring = '3800,7600,11400,15200,19000,21500,22500,72000,62000,25000,15'; break;<!-- -MONDEO-> case 'I': groupstring = '4500,8000,12000,16000,20000,24000,25000,75000,65000,40000,15'; break;<!--2WD SPORTAGE --> case 'J': groupstring = '5000,9000,13500,18000,22500,26000,27000,80000,80000,40000,15'; break;<!--4WD SPORTAGE --> case 'K': groupstring = '6500,11000,16500,22000,27500,30000,31000,950000,82500,40000,15'; break;<!--GLA + RCZ --> case 'L': groupstring = '7000,12000,18000,24000,30000,35000,360000,120000,1200000,25000,15'; break;<!-- SORENTO--> case 'M': groupstring = '2650,5300,7950,10600,13250,14600,15000,49900,48000,25000,10'; break;<!-- KANGOO--> case 'O': groupstring = '4100,8200,12300,16400,20500,20800,21000,75000,72500,40000,15'; break;<!-- TRAFIC--> } groupstring = groupstring.split(','); m = new Date (document.date.firstDate.value); month = m.getMonth(); if (days > 0 && days < 8) {total = groupstring[days - 1]; } else if (days < 28) {total = (groupstring[6] / 7) * days;} else if (days === 28) {total = groupstring[8];} if (days > 28) {total = (groupstring[8] / 28) * days;} if (month > 3 < 8 && day ==28) {total = (groupstring[9];} I'm new to java and have been given the following piece of code to try and fix. The code is renaming an existing HTML file with the current date but the problem is the date is out by one. I'm aware that in java Jan=0 Feb=1 etc but just dont know enough to know how to fix this... If I add +1 to getmonth all that happens is the file gets named LEICESTER_DAILY - 24-71-2011 17.20.36 rather than LEICESTER_DAILY - 24-8-2011 17.20.36 Here's the piece of code Code: function makePerm() { var txtFile; // Swap the temporary file with the original if (fileSys.FileExists(grabParentFolderUrl() + 'tempsave.htm')) { txtFile = fileSys.getFile(grabParentFolderUrl() + 'tempsave.htm'); if (!(txtFile.size == 0)) { // Check file is not empty if (fileSys.FileExists(grabParentFolderUrl() + 'LEICESTER_DAILY.htm')) { var today = new Date(); var timeStamp = today.getDate() + '-' + today.getMonth() + '-' + today.getFullYear() + ' ' + today.getHours() + '.' + today.getMinutes() + '.' + today.getSeconds(); txtFile = fileSys.getFile(grabParentFolderUrl() + 'LEICESTER_DAILY.htm'); txtFile.Move(grabParentFolderUrl() + 'LEICESTER_DAILY - ' + timeStamp.toString() + '.htm'); txtFile = fileSys.getFile(grabParentFolderUrl() + 'tempsave.htm'); txtFile.Move(grabParentFolderUrl() + 'LEICESTER_DAILY.htm'); I'm trying to make it so that on holidays, my page will say Happy"so and so..." at the top. I only started this 5 minutes ago so that's why it's so under developed. Here's what I have. I'm wanting to know if "today.getMonth.getDate" is valid or would I have to do something else. function startTime() { var today=new Date(); var hol=today.getMonth.getDate() if (hol==4+1) p.s I only want the holiday. I already have a clock but I want them to be separate. |