championc
08-20-2006, 06:21 PM
Hi all,
I have two fields (out of about 20) in a form which accept times. I have an ASP function to subtract one time from the other to get the difference.
I want to be able to display the difference in a text box (or label) when these have been entered and before the rest of the fields are completed.
From the second field, is it possible to write an onBlur command (or something else) that will run my ASP function
<input type="text" name="myTextBox" size="20" onBlur=myASPFunction()>
or something like this?
My ASP Function is
strSTART = (FormatDateTime(rsLogfile("START"), 4))
strEND = (FormatDateTime(rsLogfile("END"), 4))
strSTARTx = (DatePart("n", rsLogfile("START")))
strENDx = (DatePart("n", rsLogfile("END")))
strTimeHrs = (DateDiff("h", strEND, strSTART))
strTimeMin = (DateDiff("n", strEND, strSTART) Mod 60)
IF strSTARTx < strENDx THEN
strTimeHrs = strTimeHrs - 1
END IF
IF strTimeMin < 10 THEN
strTimeMin = "0" & strTimeMin
END IF
strTimeDiff = strTimeHrs & ":" & strTimeMin
I assume I can then do something like
this.form.timediff.value = strTimeDiff
Cormac
I have two fields (out of about 20) in a form which accept times. I have an ASP function to subtract one time from the other to get the difference.
I want to be able to display the difference in a text box (or label) when these have been entered and before the rest of the fields are completed.
From the second field, is it possible to write an onBlur command (or something else) that will run my ASP function
<input type="text" name="myTextBox" size="20" onBlur=myASPFunction()>
or something like this?
My ASP Function is
strSTART = (FormatDateTime(rsLogfile("START"), 4))
strEND = (FormatDateTime(rsLogfile("END"), 4))
strSTARTx = (DatePart("n", rsLogfile("START")))
strENDx = (DatePart("n", rsLogfile("END")))
strTimeHrs = (DateDiff("h", strEND, strSTART))
strTimeMin = (DateDiff("n", strEND, strSTART) Mod 60)
IF strSTARTx < strENDx THEN
strTimeHrs = strTimeHrs - 1
END IF
IF strTimeMin < 10 THEN
strTimeMin = "0" & strTimeMin
END IF
strTimeDiff = strTimeHrs & ":" & strTimeMin
I assume I can then do something like
this.form.timediff.value = strTimeDiff
Cormac