我有以下代码:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Sum Of Total Days</title>
<link rel="stylesheet" href="jquery-ui.css" />
<script src="jquery-1.9.1.js"></script>
<script src="jquery-ui.js"></script>
<script>
$(function sum() {
datepickerln1 = $( "#datepickerln1" ).datepicker().value;
datepickerln2 = $( "#datepickerln2" ).datepicker().value;
document.getElementById('#total').value = parseFloat(datepickerln2) - parseFloat(datepickerln1) +1;
});
</script>
</head>
<body>
<p>Date 1: <input name="datepickerln1" id="datepickerln1" type="text" onblur="sum()"/></p>
<p>Date 2: <input name="datepickerln2" id="datepickerln2" type="text" onblur="sum()"/></p>
<input name="total" id ="total" type="text" readonly />
</body>
</html>
当我在日期 1 和日期 2 中使用 datepicker 放置日期时,它并没有计算总天数。
请帮忙
谢谢