日期:2014-05-16 浏览次数:20409 次
function between($one,$tow){
return abs(date('W',$one) - date('W',$two));
}
<html>
<head>
<title>Demo</title>
<script type="text/javascript" src="jquery-1.4.2.min.js"></script>
</head>
<body>
<input type="text" id="time" value="2014/01/01-2014/01/10">
<div id="timeShow"></div>
<span id='countSpan'></span>
<input type="button" value="结算" id='count'>
<script type="text/javascript">
$(function(){//jquery开始 必不可少
var time = $("#time").val();
var timeArr = time.split('-');
var date1 = new Date(timeArr[0]);
var date2 = new Date(timeArr[1]);
var miao = Math.abs(date2.getTime() - date1.getTime());
var day = parseInt(miao / (1000 * 60 * 60 * 24));//计算相差天数
var input = '';
for(var i=0;i<=day;i++){
input += '<input type="text" id="day_'+i+'" class="day">';
}
$("#timeShow").html(input);
$("#count").click(function(){
var total = 0;
$(".day").each(function(){
&