Мой код должен вычитать даты (enddate-startdate), но ничего не происходит и не может понять, в чем проблема.
<script type="text/javascript">
function subtractDate()
{
var sDate = Date.parse("<%=txtStartDate.Text%>");
var eDate = Date.parse("<%=txtEndDate.Text%>");
var resultDate = document.getElementById("<%=txtnumberOfDaysCovered.ClientID%>")
if (document.getElementById(sDate) < document.getElementById(eDate)) {
var timeDiff = eDate.Subtract(sDate);
resultDate = Math.floor(timeDiff / (1000 * 60 * 60 * 24));
}
}
</script>
Я уже пытался назвать это позади
protected void txtStartDate_TextChanged(object sender, EventArgs e)
{
// SubtractDateStartDateChange();
Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "subtractDate(this.Id)", true);
}
protected void txtEndDate_TextChanged(object sender, EventArgs e)
{
//SubtractDate();
Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "subtractDate(this.Id)", true);
}