/    Sign up×
Community /Pin to ProfileBookmark

Unable to return and display dates with Javascript…

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>

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@TheBearMayApr 21.2004 — Where to start... This will need some additional work, but try starting here:

[code=php]
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);
}
[/code]
×

Success!

Help @Rashar spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...