If you want to do it entirely in ASP, you'll need to post the dates to the server then calculate the number of days and re-display the page including the calculated value and the original inputs.
Alternatively you could use a bit of javascript (or maybe even vbscript if your in an IE only intranet scenario) on the client-side which reads the input values, calculates the days and displays the result on the page without having to go to the server and back. Here's a quick 'n' dirty example which shows how to get values from input boxes and write to the page in client-side vbs.
<html>
<head>
<script language="VBScript">
Sub CalcDays()
Dim dtStart, dtEnd, nDiff, sMsg
dtStart = document.frmDate.txtStart.value
dtEnd = document.frmDate.txtEnd.value
If IsDate(dtStart) and IsDate(dtEnd) Then
nDiff = 1 + DateDiff("d", dtStart, dtEnd)
sMsg = nDiff & " days"
Else
sMsg = "valid dates only"
End If
document.getElementById("dvMsg").innerHTML = sMsg
End Sub
</script>
</head>
<body>
<form name="frmDate" id="frmDate">
Start Date : <input type="text" name="txtStart" id="txtStart"><br>
End Date : <input type="text" name="txtEnd" id="txtEnd"><br>
<div id="dvMsg"> </div><br>
<input type="button" value="Get Days" onclick="CalcDays">
</form>
</body>
</html>
hth
Phil
|