jQuery每日实时薪资收入计算器代码

来源:https://www.sucaihuo.com/js/2320.html 2017-07-05 19:58浏览(883) 收藏

jQuery每日实时薪资收入计算器代码,薪资计算js代码,计算每秒薪资,下班倒计时。
jQuery每日实时薪资收入计算器代码
分类:其它特效 > jQuery插件 难易:初级
查看演示 下载资源 下载积分: 20 积分

js代码

<script type="text/javascript">
    $(".bo").click(function(){
        $(".bo").removeClass('opt');
        $(this).addClass("opt");
        var hhs = $(this).text();
        $("#hhs").val(hhs);
    });
    $('.bos').click(function(){
       $('.bos').removeClass('opt');
        $(this).addClass("opt");
        var hs = $(this).text(); /*时间*/
        var dates=new Date(); /*日期*/
        $("#shij").val(dates.toLocaleDateString()+" "+hs);
    });
var aas;
    function aa(zq,shij,hhs){
        var me = zq; /*总*/
        var mm = 3600*hhs; /*1小时 = 3600秒   9小时*3600 = 32400秒*/
        var ms = (me/mm); /*每秒 - m*/

        var date1=new Date(shij);    //开始时间
        var date2=new Date();//当前时间
        var date3=date1.getTime()-date2.getTime(); //时间差秒
        //计算出相差天数
        var days=Math.floor(date3/(24*3600*1000));
        //计算出小时数
        var leave1=date3%(24*3600*1000); //计算天数后剩余的毫秒数
        var hours=Math.abs(Math.floor(leave1/(3600*1000))+1);
        //计算相差分钟数
        var leave2=leave1%(3600*1000);        //计算小时数后剩余的毫秒数
        var minutes=Math.abs(Math.floor(leave2/(60*1000)));
        var leave3=leave2%(60*1000);     //计算分钟数后剩余的毫秒数
        var seconds=Math.abs(Math.round(leave3/1000));
        var sh = (3600*hours)+(minutes*60)+seconds;
        var va = sh;
        function formatSeconds(value) {
            var theTime = parseInt(value);// 秒
            var theTime1 = 0;// 分
            var theTime2 = 0;// 小时
            if(theTime > 60) {
                theTime1 = parseInt(theTime/60);
                theTime = parseInt(theTime%60);
                if(theTime1 > 60) {
                    theTime2 = parseInt(theTime1/60);
                    theTime1 = parseInt(theTime1%60);
                }
            }
            var result = ""+parseInt(theTime)+"秒";
            if(theTime1 > 0) {
                result = ""+parseInt(theTime1)+"分"+result;
            }
            if(theTime2 > 0) {
                result = ""+parseInt(theTime2)+"小时"+result;
            }
            return result;
        }

         aas =  setInterval(function(){
            va++;
            var date = new Date();
            var year = date.getFullYear();
            var month = date.getMonth()+1;
            var day = date.getDate();
            var hour = date.getHours();
            var minute = date.getMinutes();
            var second = date.getSeconds();
            $("#aas").html("¥:"+(va*ms).toFixed(2));
            $("#a2").html((ms/10).toFixed(4));
            $("#aa").html(ms.toFixed(3));
            $("#a1").html((ms*60).toFixed(2));
            $("#a").html((me/9).toFixed(2));
            $("#date").html(year+'年'+month+'月'+day+'日'+hour+':'+minute+':'+second);
            $("#as").html(me/9*9);
//            console.log(formatSeconds(mm-va));
            $("#a123").html(formatSeconds(mm-va));
        },1000);
    }

    $('.qq').click(function(){
        clearInterval(aas);
        var zq = $("#zq").val();
        var shij = $("#shij").val();
        var hhs = $("#hhs").val();
        aa(zq,shij,hhs);
        $(".box-1").hide();
        $(".box-2").show();
    });

    $(".back-s").click(function(){
        $(".box-2").hide();
        $(".box-1").show();
    });

</script>
标签: 计算器
评论0
头像

系统已开启自动识别垃圾评论机制,识别到的自动封号,下载出错或者资源有问题请联系全栈客服QQ 1915635791

1 2