Click to See Complete Forum and Search --> : Unable to return and display dates with Javascript...


Rashar
04-21-2004, 01:17 PM
Good afternoon,

I have a form that uses 2 popup calendars to submit dates into a textbox ( textboxes are labeled datebox, and datebox1.) Once the date is entered into the 2 fields the submit button executes my javascript process page. I've created a function to show all dates between the start date and end date, but when I run the program, I just get a blank screen. I've tried to call 2 functions for each date, that didn't work...so I narrowed it down to 1 function. Any assistance would be greatly appreciated. Thanks.

Note: I put single quotes in my for loop so it does not show as a smily face.


<html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>
<script language="JavaScript">

function showDates(beginDate,endDate) {
beginDate = document.calform.datebox.value;
endDate = document.calform.datebox1.value;

for (';;') {
// infinite loop
if (startDate > endDate) {
// break out of infinte loop and function
return;
}
document.write(showDates(beginDate) + '-' + showDates(endDate));
}
}

</script>
<body>

</body>

</html>

TheBearMay
04-21-2004, 02:28 PM
Where to start... This will need some additional work, but try starting here:


function showDates() {
beginDate = document.calform.datebox.value;
endDate = document.calform.datebox1.value;

if (startDate > endDate) {
alert("Error End Date must be Greater than Start Date");
return;
}

document.write(beginDate + '-' + endDate);
}