php基础+jquery基础,该怎么解决

WBOY
Release: 2016-06-13 11:50:43
Original
902 people have browsed it

php基础+jquery基础
1.编写一个函数,使它可以根据传入的2个年周号,返回它们之间的周数(包括传入的这两周)


2.用JQuery实现根据所选的日期范围动态增加那范围内每一天的金额输入框,并在最后面显示出所有天金额的累加值
------解决方案--------------------
1.

function between($one,$tow){<br />	return abs(date('W',$one) - date('W',$two));<br />}
Copy after login

------解决方案--------------------
2.
<html><br />    <head><br />        <title>Demo</title><br />        <script type="text/javascript" src="jquery-1.4.2.min.js"></script><br /><br />    </head><br /> <br />    <body><br />            <input type="text" id="time" value="2014/01/01-2014/01/10"><br />            <div id="timeShow"></div><br />            <span id='countSpan'></span><br />            <input type="button" value="结算" id='count'><br />            <script type="text/javascript"><br />            $(function(){//jquery开始 必不可少<br />                <br />                 var time = $("#time").val();<br />                 var timeArr = time.split('-');<br />                 var date1 = new Date(timeArr[0]);<br />                 var date2 = new Date(timeArr[1]);<br />                 var miao = Math.abs(date2.getTime() - date1.getTime());<br />                 var day = parseInt(miao / (1000 * 60 * 60 * 24));//计算相差天数<br /><br />                 var input = '';<br />                 for(var i=0;i<=day;i++){<br />                    input += '<input type="text" id="day_'+i+'" class="day">';<br />                 }<br />                 $("#timeShow").html(input);<br /><br />                 $("#count").click(function(){<br />                    var total = 0;<br />                    $(".day").each(function(){<br />                        var val = $(this).val();<br />                        val = $.trim(val);<br />                        val = isNaN(val) <br><font color='#FF8000'>------解决方案--------------------</font><br> val == "" ? 0 : val;<br />                        total += parseFloat(val);<br />                    })<br />                    $("#countSpan").html(total);<br />                 })<br />                 <br />            })<br />            <br />        </script><br />    </body><br /></html>
Copy after login

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template