I have a PHP function that accepts two dates and returns the number of business days between them (holidays included, because we pay out on those). Right now, I can call this function within a Javascript function and get a value back if I send the function real dates. For example:
function daycount() {
var days="<?php echo getDays("01/01/2014","01/31/2014"); ?>";
document.write(days);
}
This returns 23, as expected. What I would like to have happen is for the user to be able to put start and end dates in two fields and then feed those field values to the above function, displaying the result without the user having to submit the form. Something like this:
<label for="startDate">Start</label>
<input type="text" name="startDate" id="startDate" onFocus="daycount();" />
<label for="endDate">End</label>
<input type="text" name="endDate" id="endDate" onFocus="daycount();" />
Is this possible?
Date()object which can do this sort of thing for you.