I found this code and would like to make it so that if a person is checking availability for something, when the correct date is selected, it goes to a URL. Example, click DEC. 18 2010 and it goes to one URL, Dec.19 2010 and it goes to another. or Dec. 18 2011 and it goes to another. I dont understand how to correlate all that. any help would be much appreciated!
[code=html]
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>
<script>
//to check leap year
function checkleapyear(d atea)
{
datea = parseInt(datea) ;
if(datea%4 == 0)
{
if(datea%100 != 0)
{
return true;
}
else
{
if(datea%400 == 0)
return true;
else
return false;
}
}
return false;
}
//to populate drop drow boxex with the current month and date
function populateYearSel ect()
{
d = new Date();
curr_year = d.getFullYear() ;
curr_month=d.ge tMonth();
document.getEle mentById('month ').options[curr_month].selected=true;
for(i = 0; i < 3; i++)
{
document.getEle mentById('year' ).options[i] = new Option(curr_yea r-i,curr_year-i);
}
if(curr_month== 0 || curr_month==2 ||curr_month==4 || curr_month==6 || curr_month==7 || curr_month==9 || curr_month===11 )
{
for(i=0;i<=30;i ++)
document.getEle mentById('day') .options[i] = new Option(i+1,i+1) ;
}
else if(curr_month== 3 || curr_month==5 ||curr_month==8 || curr_month==10)
{
for(i=0;i<=29;i ++)
document.getEle mentById('day') .options[i] = new Option(i+1,i+1) ;
}
if(curr_month== 1)
{
var year=document.g etElementById(' year').value;
if(checkleapyea r(year))
{ for(i=0;i<=28;i ++)
document.getEle mentById('day') .options[i] = new Option(i+1,i+1) ; }
else
{ for(i=0;i<=27;i ++)
document.getEle mentById('day') .options[i] = new Option(i+1,i+1) ;}
}
}
</script>
<body onLoad="populat eYearSelect()">
<select name="year" id="year" >
</select>
<select name="month" id="month">
<option value=01>JAN</option>
<option value=02>FEB</option>
<option value=03>MAR</option>
<option value=04>APR</option>
<option value=05>MAY</option>
<option value=06>JUN</option>
<option value=07>JUL</option>
<option value=08>AUG</option>
<option value=09>SEP</option>
<option value=10>OCT</option>
<option value=11>NOV</option>
<option value=12>DEC</option>
</select>
<select name="day" id="day">
</select>
</body>
</html>
[/code]
[code=html]
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>
<script>
//to check leap year
function checkleapyear(d atea)
{
datea = parseInt(datea) ;
if(datea%4 == 0)
{
if(datea%100 != 0)
{
return true;
}
else
{
if(datea%400 == 0)
return true;
else
return false;
}
}
return false;
}
//to populate drop drow boxex with the current month and date
function populateYearSel ect()
{
d = new Date();
curr_year = d.getFullYear() ;
curr_month=d.ge tMonth();
document.getEle mentById('month ').options[curr_month].selected=true;
for(i = 0; i < 3; i++)
{
document.getEle mentById('year' ).options[i] = new Option(curr_yea r-i,curr_year-i);
}
if(curr_month== 0 || curr_month==2 ||curr_month==4 || curr_month==6 || curr_month==7 || curr_month==9 || curr_month===11 )
{
for(i=0;i<=30;i ++)
document.getEle mentById('day') .options[i] = new Option(i+1,i+1) ;
}
else if(curr_month== 3 || curr_month==5 ||curr_month==8 || curr_month==10)
{
for(i=0;i<=29;i ++)
document.getEle mentById('day') .options[i] = new Option(i+1,i+1) ;
}
if(curr_month== 1)
{
var year=document.g etElementById(' year').value;
if(checkleapyea r(year))
{ for(i=0;i<=28;i ++)
document.getEle mentById('day') .options[i] = new Option(i+1,i+1) ; }
else
{ for(i=0;i<=27;i ++)
document.getEle mentById('day') .options[i] = new Option(i+1,i+1) ;}
}
}
</script>
<body onLoad="populat eYearSelect()">
<select name="year" id="year" >
</select>
<select name="month" id="month">
<option value=01>JAN</option>
<option value=02>FEB</option>
<option value=03>MAR</option>
<option value=04>APR</option>
<option value=05>MAY</option>
<option value=06>JUN</option>
<option value=07>JUL</option>
<option value=08>AUG</option>
<option value=09>SEP</option>
<option value=10>OCT</option>
<option value=11>NOV</option>
<option value=12>DEC</option>
</select>
<select name="day" id="day">
</select>
</body>
</html>
[/code]
Comment