Hi all,
I have two dates with format [mm/dd/yy]
and I want to get the number of days difference.
and how can I make the text of "X" days to become red if the result is negative
Im a quick learner if i just know the basics. hope you can guide me to a good start on my coding.
here where im at now:
<html>
<head>
<title></title>
</head>
<body>
<script language="javascript">
function subtractdate(form)
{
var a = form.datetextbox1.value;
var b = form.datetextbox2.value;
var datedifference = parseFloat(a) - parseFloat(b) + " days difference"; // <--i think this is not correct
document.getElementById('result').innerHTML = datedifference;
}
</script>
<form>
ie. [mm/dd/yy] - [mm/dd/yy] = X/-X days difference<br><br>
<input type=text name="datetextbox1" onchange="subtractdate(this.form);">-
<input type=text name="datetextbox2" onchange="subtractdate(this.form);">
<div id="result"></div>
</form>
</body>
</html>
I have two dates with format [mm/dd/yy]
and I want to get the number of days difference.
and how can I make the text of "X" days to become red if the result is negative
Im a quick learner if i just know the basics. hope you can guide me to a good start on my coding.
here where im at now:
<html>
<head>
<title></title>
</head>
<body>
<script language="javascript">
function subtractdate(form)
{
var a = form.datetextbox1.value;
var b = form.datetextbox2.value;
var datedifference = parseFloat(a) - parseFloat(b) + " days difference"; // <--i think this is not correct
document.getElementById('result').innerHTML = datedifference;
}
</script>
<form>
ie. [mm/dd/yy] - [mm/dd/yy] = X/-X days difference<br><br>
<input type=text name="datetextbox1" onchange="subtractdate(this.form);">-
<input type=text name="datetextbox2" onchange="subtractdate(this.form);">
<div id="result"></div>
</form>
</body>
</html>