asp.net js 倒计时总秒数量 和 排序

        Edit in JSFiddle JavaScript HTML CSS Result h1 {
            font-family: "微软雅黑";
            font-size: 40px;
            margin: 20px 0;
            border-bottom: solid 1px #ccc;
            padding-bottom: 20px;
            letter-spacing: 2px;
        }

        .time-item strong {
            background: #C71C60;
            color: #fff;
            line-height: 49px;
            font-size: 36px;
            font-family: Arial;
            padding: 0 10px;
            margin-right: 10px;
            border-radius: 5px;
            box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.2);
        }

        #day_show {
            float: left;
            line-height: 49px;
            color: #c71c60;
            font-size: 32px;
            margin: 0 10px;
            font-family: Arial, Helvetica, sans-serif;
        }

        .item-title .unit {
            background: none;
            line-height: 49px;
            font-size: 24px;
            padding: 0 10px;
            float: left;
        }

        var intDiff = parseInt(86400); //倒计时总秒数量

        function timer(intDiff) {
            window.setInterval(function () {
                var day = 0,
                    hour = 0,
                    minute = 0,
                    second = 0; //时间默认值
                if (intDiff > 0) {
                    day = Math.floor(intDiff / (60 * 60 * 24));
                    hour = Math.floor(intDiff / (60 * 60)) - (day * 24);
                    minute = Math.floor(intDiff / 60) - (day * 24 * 60) - (hour * 60);
                    second = Math.floor(intDiff) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60);
                }
                if (minute <= 9) minute = ‘0‘ + minute;
                if (second <= 9) second = ‘0‘ + second;
                $(‘#day_show‘).html(day + "天");
                $(‘#hour_show‘).html(‘<s id="h"></s>‘ + hour + ‘时‘);
                $(‘#minute_show‘).html(‘<s></s>‘ + minute + ‘分‘);
                $(‘#second_show‘).html(‘<s></s>‘ + second + ‘秒‘);
                intDiff--;
            }, 1000);
        }

        $(function () {
            timer(intDiff);
        });

    <h1>网页上的倒计时</h1>

    <div class="time-item">
        <span id="day_show">0天</span>
        <strong id="hour_show">0时</strong>
        <strong id="minute_show">0分</strong>
        <strong id="second_show">0秒</strong>

    </div>

---------------------------------------排序
        function test() {
            var numbers = [12, 23, 10, 56, 7, 88, 92, 49];
            numbers = numbers.sort(function (a, b) {
                return a - b;
            })
            var val;
            for (var i = 0; i < numbers.length; i++) {
                val += numbers[i] + ‘<br/>‘;

            }
            $(‘#show8‘).html(val);

        }

        <div>
            <input type="button" value="提交" onclick="test()" />
            <h3>数值数组排序前</h3>
            <div id="show7"></div>
            <h3>排序后</h3>
            <div id="show8"></div>
        </div>
时间: 2024-10-29 10:46:48

asp.net js 倒计时总秒数量 和 排序的相关文章

js倒计时,秒倒计时,天倒计时

按天倒计时 HTML代码1: <Script Language="JavaScript"> <!-- Begin var timedate= new Date("January 14,2006"); var times="研究生考试"; var now = new Date(); var date = timedate.getTime() - now.getTime(); var time = Math.floor(date /

js倒计时60秒获取验证码

var wait=60; function settime(o) { if (wait == 0) { o.removeAttribute("disabled"); o.value="发送验证码"; wait = 60; } else { o.setAttribute("disabled", true); o.value="重新发送(" + wait + ")"; wait--; setTimeout(fu

js 倒计时多少秒

var wait=60;function time() {    if (wait == 0) {        $("#niao").removeAttr("disabled");        $("#niao").val("重新发送");        $("#niao").removeClass("niao c_on").addClass("niao");  

小巧实用js倒计时

<script type="text/javascript"> var intDiff = parseInt(15); //倒计时总秒数量 function timer(intDiff) { index = window.setInterval(function () { var day = 0, hour = 0, minute = 0, second = 0; //时间默认值 if (intDiff > 0) { day = Math.floor(intDiff

用js在网页上完成倒计时3秒后自动跳转到另一个页面

<body> <div id="time"></div> <a href="#" onclick="stop()">停止</a> <script type="text/javascript"> var i=3; function changeTime(){ document.getElementById("time").innerHTM

js实现倒计时60秒的简单代码(推荐)

<!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>js实现倒计时60秒的简单代码(推荐)</title> <script type="text/javascript"

点击按钮 倒计时60秒方可再次点击发送的Js代码

本节内容:Javascript 实现 点击按钮 倒计时60秒方可再次点击发送的效果. 比如,一些网站上的手机短信认证的功能,有类似实现点击按钮后,倒计时60秒才能再次点击发送的效果. 本文用Javascript实现点击按钮后,倒计时60秒才能再次点击发送验证码的功能. 例子: 复制代码代码示例: <input type="button" id="btn" value="免费获取验证码" /><script type="

js倒计时的实现

下面简单介绍三种不同的倒计时方法. 先来看一种使用的getTime()方法,.这个时间指的是从1970年午夜到现在的时间,.好了知道了这个,就好办了,. 来看看代码 <script> function fresh(){ var over = "2016/12/11,20:00:00"; var endtime = new Date(over); var nowtime = new Date(); var leftsecond = parseInt((endtime.getT

js倒计时关闭当前页面代码

js倒计时关闭当前页面代码:很多网站在关闭网页之前会给出一个倒计时效果,这样可以让浏览者做到根据相应的情况进行操作,比较人性化,下面就通过实例代码介绍一下如何实现此效果.代码实例如下: <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name=&quo