...

View Full Version : Comparing drop down values



lukeMV
06-30-2006, 03:55 PM
I want people to enter a start month and year and an end month and year. I want to create a script that ensures that the end month and year is not before the start month and year. My thought was to have a drop down menu for start month, and a drop down for start year, and the same for the end month/year. Does anyone have a script that will compare the years to ensure the end is greater than the start....and if its hte same, then look at the month to ensure that the end month is greater than the start month? Thanks!

Beagle
06-30-2006, 04:19 PM
function compareStuff(startYearSelect, startMonthSelect, endYearSelect, endMonthSelect)
{
if (Number(startYearSelect.value) < Number(endYearSelect.value))
{
return true;
}
else if (Number(startYearSelect.value) == Number(endYearSelect.value) && Number(startMonthSelect.value) < Number(endMonthSelect.value))
{
return true;
}
else
{
return false;
}
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum