I have two dates using the obout controls, when both dates are entered instead of having the user enter the total number of days field text box, I wish to have a piece of javascript that would automatically calculate the total number from looking at the start and finish date entered.With a label displaying the calculated total days value.So far it is not generating anything in my label, but it runs ok so im guessing im not far off.
Here is my javascript
var startDate = new Date(document.getElementByName('txtstartdate').Value);
var endDate = new Date(document.getElementByName('TxtFinish').Value);
var days = 24 * 60 * 60 * 1000;
var distance = (endDate - startDate) / days;
var lbltotal = $get('<%= lbltotal %>');
var lbltotal = lbltotal.innerText;