Coldfusion will not execute client side - use javascript. To find the
difference in days convert the two dates into milliseconds from 1970 user
date.parse or date.UTC and then subtract and divide to get the number of
days - easy.
Mark
-----Original Message-----
From: Colby L Reese [SMTP:[EMAIL PROTECTED]]
Sent: Sun, 16 Apr 2000 21:30
To: [EMAIL PROTECTED]
Subject: javascript date calculation
I am trying to create some kind of script to calculate the
difference between two dates. It would be nice if this would calculate
right after the date is entered in the form using
onblur and a function. I have tried messing with some scripts
similar to what's below just to try using cf functions inside a javascript.
I would like to use the datediff function
but I have not found a good way to get coldfusion to execute it
using an onblur.
Thanks
Colby
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<script language="JavaScript">
<!--
function diff()
{
<cfoutput>
document.test.date.value = #DateDiff("D", CreateDate(2000, 1, 1),
Now())#
document.test.date2.value = #ParseDateTime(document.test.date1)#
</cfoutput>
}
// -->
</script>
<title>Untitled</title>
</head>
<body>
<cfoutput>
#Now()#
<form name="test">
<input type="Text" name="date">
<input type="Text" name="date1" onBlur="diff()">
<input type="Text" name="date2">
</form>
</cfoutput>
</body>
</html>
----------------------------------------------------------------------------
--
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.